DoCmd.FindRecord syntax

  • Thread starter Thread starter Darrell
  • Start date Start date
D

Darrell

I am attempting to find a record on a form where a
control's value is "AAAS". The following code generates
an error when run. Can someone help me with why?

Private Sub cmdFindPayee_Click()

DoCmd.OpenForm "frmPayee"
DoCmd.FindRecord "AAAS"

End Sub

Thanks.
Darrell
 
-----Original Message-----
I am attempting to find a record on a form where a
control's value is "AAAS". The following code generates
an error when run. Can someone help me with why?

Private Sub cmdFindPayee_Click()

DoCmd.OpenForm "frmPayee"
DoCmd.FindRecord "AAAS"

End Sub

Thanks.
Darrell
Hi Darrell, access has no idea where to search for the
value. Try...

DoCmd.FindRecord "[FieldName]=AAAS"

or

' chr(34) handles strings within strings that may include
single quotes/apostraphies

strFind = chr(34) & "AAAS" & chr(34)
DoCmd.FindRecord "[FieldName]=" & strFind

Luck
Jonathan
 
Back
Top