Why isn't form opening and showing all records

I have a 2nd form which opens from an onclick event on form 1.  But when form 2 opens it opens to create a new record instead of showing all the records asociated to the key field, "EstN".  EstN is a text field.  Here's my code.  

Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmOutpurchase"
    DoCmd.OpenForm stDocName, acNormal, , "EstN = " & Me.txtRealEstN, acFormEdit
SteveL13Asked:
Who is Participating?
 
clarkscottConnect With a Mentor Commented:
whoops... typo

" & chr(34) & Me.txtRealEstN & chr(34),

You can also use "'"    Quote - apostrophe - Quote instead of Chr(34).

Scott C
0
 
clarkscottCommented:
DoCmd.OpenForm stDocName, acNormal, , "EstN = " & chr(34( & Me.txtRealEstN & chr(34), acFormEdit

Chr(34) = quotes.  Must put quotes around text field criteria

Scott C
0
 
SteveL13Author Commented:
Thanks.  Worked perfectly.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.