Hello:
I need some assistance with re-querying a DLOOKUP control.
Process:
- I have a form including 2 listboxes allowing to select a *SINGLE* value each.
- Upon executing a command button the 2 listbox values are passed into a query (criteria) and then automatically update the subform's data source.
- This works great!
Next:
- Upon reopening the form, the subform's reloads (reopens) the data source based on the previous query execution.
- While that's ok, I'd have added 2 unbound controls containing a DLOOKUP parameter.
- That said, when reopening the form, the 2 unbound control show the previous value selection which matches the subform's underlying data set.
Challenge:
- While the above works fine, the moment I re-execute the query with different values from the listbox, the displayed values in the 2 unbound controls do NOT reflect the current listbox values.
Control Source for DLookups in unbound control "txtFIELD_XYZ":
Code:
=DLookUp("FIELD_XYZ","Queryname")
Code:
Private Sub lst_LIST1_AfterUpdate()
Me.txtFIELD_XYZ.Requery
End Sub
My question:
- What code is missing/required to ensure the unbound's control DLOOKUP is updated immediately after the listbox value has changed?
- Apparently, the above AFTERUPDATE function alone does not work properly. At least, the displayed value is NOT updated immediately... it seems like it's lagging 1 step behind.