Requery not working in a form with combo boxes

drspanda@gmail.com

New member
Local time
Today, 07:02
Joined
Jan 30, 2015
Messages
9
Dear All,

New to access...just build a form, in which there are combo boxes....cascading of boxes was done with your help.

Now the problem is I want afterupdate function to get activated when user changes the value of one combo....for which I have created a code in code builder...please see the code...I think I am making a mistake in writing the code to requery...
Regards,
drspanda
 

Attachments

When you cycle through the different records you need the requery the comboboxes.

Code:
Private Sub Form_Current()
  Me.cbo_Area_ID.Requery
  Me.cbo_SWGR_ID.Requery
End Sub
 
Code:
Private Sub cbo_Area_ID_AfterUpdate()
Me.cbo_Main_Area_ID.Requery
Me.cbo_SWGR_ID.Requery
End Sub

Private Sub cbo_Main_Area_ID_AfterUpdate()
Me.cbo_Area_ID.Requery
Me.cbo_SWGR_ID.Requery
End Sub

Private Sub cbo_SWGR_ID_AfterUpdate()
Me.cbo_Area_ID.Requery
Me.cbo_Main_Area_ID.Requery
End Sub

is also not working.
 
Did you put the below code in the Form on current event?
Code:
Private Sub Form_Current()
   Me.cbo_Area_ID.Requery
   Me.cbo_SWGR_ID.Requery
End Sub
Database is attached.
 

Attachments

Did you put the below code in the Form on current event?
Code:
Private Sub Form_Current()
   Me.cbo_Area_ID.Requery
   Me.cbo_SWGR_ID.Requery
End Sub
Database is attached.

Yes...It worked after pasting the code...Thank You very much...Can you please explain why we require this code and why afterupdate code alone is not sufficient??
 
Because when you move to a another record the value in the first combobox change, therefore you need to requery the other comboboxes!
Going to another record doesn't trigger the "After update" event.
 

Users who are viewing this thread

Back
Top Bottom