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 / October 2005

Tip: Looking for answers? Try searching our database.

On change to populate unbound form data

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ace9x - 10 Oct 2005 21:00 GMT
I have a form with 2 subcontrols (each a form). User inputs required info in
main form combo box, in combo box 1 and then combo box 2. This works great.
Subcontrol2 form contains unbound data fields only, populated on the On
Change event in combo box 2.

When the 1st subcontrol combobox is changed, I am trying to populate the 2nd
subcontrol form with the values based on the 1st and 2nd  combobox's (2nd
combobox retains its original value).

To attempt to force the form into working, I have coded an On Change event
on the 1st combobox which does the following :-

1) Stores the value of combo box 2
2) Sets Combobox 2 to another value
3) Populates Combobox 2 with the original value - hope that would trigger On
Change event??
4) Issue a Requery on subcontrol 2 combobox

The values of the combo box change as coded, but the on change event is not
being invoked by the change in value.

Can anyone tell me where I am going wrong please

Cheers,
Steve
John Vinson - 10 Oct 2005 22:04 GMT
>I have a form with 2 subcontrols (each a form). User inputs required info in
>main form combo box, in combo box 1 and then combo box 2. This works great.
>Subcontrol2 form contains unbound data fields only, populated on the On
>Change event in combo box 2.

Note that the Change event's name might be misleading. The AfterUpdate
event may be preferable - it fires when a value has been selected; the
Change event fires at every single keystroke in the control.

>When the 1st subcontrol combobox is changed, I am trying to populate the 2nd
>subcontrol form with the values based on the 1st and 2nd  combobox's (2nd
[quoted text clipped - 7 lines]
>3) Populates Combobox 2 with the original value - hope that would trigger On
>Change event??

No, it won't: again - Change fires only when the user types or selects
in the combo. Programmatic events won't trigger it.

>4) Issue a Requery on subcontrol 2 combobox
>
>The values of the combo box change as coded, but the on change event is not
>being invoked by the change in value.
>
>Can anyone tell me where I am going wrong please

Assuming that a) the Change is the right event and b) that it will be
fired when you run your code. Neither is correct!

I'd just move the code from Change to AfterUpdate, and explicitly call
the AfterUpdate event from your code.

                 John W. Vinson[MVP]    
Ace9x - 11 Oct 2005 10:19 GMT
John,
Thanks for the help on this, have one question though.
How do I 'explicitly call' the AfterUpdate event on the subcontrol2 combobox
from the code in subcontrol1 combobox On Change event?

Cheers,
Steve

> >I have a form with 2 subcontrols (each a form). User inputs required info in
> >main form combo box, in combo box 1 and then combo box 2. This works great.
[quoted text clipped - 34 lines]
>
>                   John W. Vinson[MVP]    
 
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.