Why isn't form opening and showing all records

Posted on 2011-04-22
Last Modified: 2013-11-05
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
Question by:SteveL13
    LVL 20

    Expert Comment

    DoCmd.OpenForm stDocName, acNormal, , "EstN = " & chr(34( & Me.txtRealEstN & chr(34), acFormEdit

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

    Scott C
    LVL 20

    Accepted Solution

    whoops... typo

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

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

    Scott C

    Author Closing Comment

    Thanks.  Worked perfectly.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    In the article entitled Working with Objects – Part 1 (, you learned the basics of working with objects, properties, methods, and events. In Work…
    In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
    With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    8 Experts available now in Live!

    Get 1:1 Help Now