subform combo lookup

S

Starry

My mainform lookup combo (cmbJobfind) finds a subform record based on
selection and works great until I click on a subform record then it stops
working but gives no error. If I change the mainform record the combo values
change (as they should) along with the records displayed in the subform but
the (cmbJobfind)still fails to do its job. Provided that I don't click on a
record it works fine regardless of any main form changes.

Code
Private Sub cmbJobfind_AfterUpdate()
Dim strJobnum As String

strJobnum = Me.cmbJobfind.Value
Me.Jobs.SetFocus
DoCmd.FindRecord strJobnum, acEntire, False, , False, acCurrent, True
'Me.SetFocus <just guessing that mainform needed focus but makes no
difference
End Sub

No doubt I'm just being a bit dim please show me where thanks.
 
S

Starry

I was being dum! I missed the acCurrent property in my Findrecord command.
If I clicked in a alternative field to the one that the combo uses then of
course it is no longer valid so keeping acCurrent to speed the search I just
shifted the focus back to the correct field first

Private Sub cmbJobfind_AfterUpdate()
Dim strJobnum As String

strJobnum = Me.cmbJobfind.Value
Me.Jobs.SetFocus
Forms![Clients]!Jobs.Controls!txtJobNumber.SetFocus
DoCmd.FindRecord strJobnum, acEntire, False, , False, acCurrent, True
End Sub

thought this may help someone else any further comment welcome.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top