0
votes

I have a form with a combo box with a list of jobs located on a different form all with their own unique record. I would like to be able to click the drop-down of the combo box, select a specific job and then have it open the specific job record I select... Struggling with coming up a VBA code that will do this. Can anyone help? Thanks

1

1 Answers

1
votes

If you want to open another form that just shows the record selected in a combo box, then you can use the control's AfterUpdate event, and use the "Where condition" argument of the OpenForm action:

Private Sub cboSearch_AfterUpdate()
    On Error GoTo E_Handle
    DoCmd.OpenForm "frmData", , , "FileID=" & Me!cboSearch
sExit:
    On Error Resume Next
    Exit Sub
E_Handle:
    MsgBox Err.Description & vbCrLf & vbCrLf & "frmSearch!cboSearch_AfterUpdate", vbOKOnly + vbCritical, "Error: " & Err.Number
    Resume sExit
End Sub

Regards,