Double-click event error

G

Guest

I have a search form on which the user enters search criteria, clicks a
search button and the matching records are displayed on a subform. I used
the following code to navigate from the subform to the appropriate record (on
a separate form) and get a run time error 2501 when double-clicking on a text
field - the same code works if I use it on a numeric field. Is there anyway
to use it on a text field? It seems Access can't identify a match if it's a
text field even though the data is an exact match. (in the case below, it is
an exact 9 character match, no leading or trailing spaces)

Private Sub TIN_DblClick(Cancel As Integer)

DoCmd.OpenForm "frm_Vendor", _
whereCondition:="TIN =" & Me!TIN

End Sub

Any ideas? Thanks!
 
G

Guest

For text field you need to add a single column before and after

DoCmd.OpenForm "frm_Vendor", _
whereCondition:="TIN ='" & Me!TIN & "'"
 
G

Guest

Thanks! It worked great.

Lori

Ofer Cohen said:
For text field you need to add a single column before and after

DoCmd.OpenForm "frm_Vendor", _
whereCondition:="TIN ='" & Me!TIN & "'"
 

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