Vlad, I have an update. I ran into trouble when I tried this in the Volunteers form. I created the combo box in the form header and it worked for the lookup at first. But when I added the code for clearing the field it stopped finding the record.
Creating the combo box automatically set up an event procedure for the control, but I couldn't figure out how to work with the Macro Builder to edit it. So, just like on the Activity form, I deleted the event procedure and used the "..." to select Code Builder (VBE) which is more familiar to me.
The Form_frmVolunteers class object was already created and I navigated to the "SelectVID" control and selected AfterUpdate. Then I copied in the exact code that worked in the Activity form and updated it for the Volunteers form, but it wouldn't find the record.
Code:
Private Sub SelectVID_AfterUpdate()
On Error Resume Next
Me.VID.SetFocus 'the VolunteerID text box is present but not visible
DoCmd.FindRecord Me.SelectVID
Me!SelectVID.SetFocus
Me.SelectVID = Null
End Sub
I added a debug.print to be sure it was capturing the correct record number from the SelectVID control (and it was). But then the DoCmd.FindRecord Me.SelectVID line simply didn't work.
Any thoughts?
- Jeff