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.
Starry - 29 Mar 2007 13:35 GMT
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.
> 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
[quoted text clipped - 15 lines]
>
> No doubt I'm just being a bit dim please show me where thanks.