Problem with OpenForm & SearchForRecord

Will Sidwell

New member
Local time
Tomorrow, 11:24
Joined
Mar 30, 2016
Messages
3
Hey Folks,

Am using a combo box on my Clients form to search for records using:
Code:
DoCmd.SearchForRecord acDataForm, "frmClients", acFirst, "[numClientID] = " & Str(Nz(Screen.ActiveControl, 0))
This works fine when I open the Clients form myself but when I use OpenForm:
Code:
DoCmd.OpenForm "frmClients", acNormal, "", "numClientID = " & Me!txtClientLookup, , acNormal
from another form to open the Clients form the DoCmd.SearchForRecord doesn't work in that it doesn't populate the form with the selected record. No error messages are displayed.
Any thoughts? :)
 
If numClientID is the name of the field in the form's recordsource, and assuming both numClientID and Me!txtClientLookup are numeric, try

DoCmd.OpenForm "frmClients", , , "numClientID = " & Me!txtClientLookup
 

Users who are viewing this thread

Back
Top Bottom