Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / March 2008

Tip: Looking for answers? Try searching our database.

Synchronizing Subforms

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
djf - 29 Feb 2008 17:31 GMT
I have a form with a combo box (A), a list box (B) and a datasheet view sub
form (C).

The user chooses a value in A, which brings up a list of corresponding
values in B. The user then chooses a value in B which brings up corresponding
values in C. Once the user is done looking at the records he starts the
process over by choosing a new value in A.

When the user chooses a new value in A, I want C to go back to its default
value of no records.

I have successfully done this on a different form where C is a list box
instead of a sub form. In the on change property for A I put in this code:

Me.lstActID_A.RowSource = ""

This resets the list box C back to no records.



Does anyone know how to reset the sub form back to no records?
Klatuu - 29 Feb 2008 20:04 GMT
For a subform's recordset on a form the syntax would be:

Me.SubFormControlName.Form.RecordSource = vbNullString

SubFormControlName is the name of the subform control on your form, not the
name of the form specified in the subform control's Source Object property.

(vbNullString is the same as "" - You actually get better performance using
intrinsic constants than you do literals.)

That would mean, then that you would have to assign the rowsource in the
After Update event of B.

One other thing.  Don't use the Change event.  It means literally what is
says, so the Change event fires on every keystroke.  Use the After Update
event instead.
Signature

Dave Hargis, Microsoft Access MVP

> I have a form with a combo box (A), a list box (B) and a datasheet view sub
> form (C).
[quoted text clipped - 23 lines]
>
>  
djf - 03 Mar 2008 17:01 GMT
Thanks for the input. The code does work to set the form back to no records.
There is one glitch however. It leaves #Name? in every field instead of
displaying blank fields like it does when I open the form. It also messes up
the function of menu B. Once the subform goes to null with the #Name? in each
field, it will not populate with new values when I make a choice in menu B.
It stays stuck with the #Name? values. Without the new code it works
correctly.

I'll keep playing with it, but so far I can't get it to work quite right.
I'm sure it's operator error, but any insights would be greatly appreciated.

> For a subform's recordset on a form the syntax would be:
>
[quoted text clipped - 40 lines]
> >
> >  
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.