?
Solved

How open forms using certain criteria

Posted on 2011-10-11
2
Medium Priority
?
265 Views
Last Modified: 2013-11-05
I have a command button on a form which when clicked I want to have a second form open to display only certain records.  Here is my code which is not working.

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmPrintOrdTranx"
    DoCmd.OpenForm stDocName, acNormal, , [Type] = "P", acFormEdit, acWindowNormal

Can some please help?
0
Comment
Question by:SteveL13
2 Comments
 
LVL 49

Accepted Solution

by:
Dale Fye earned 2000 total points
ID: 36950959
Try:

    DoCmd.OpenForm stDocName, acNormal, , "[Type] = 'P'", acFormEdit, acWindowNormal

Note that the P is wrapped with single quotes and the entire WHERE condition is wrapped in quotes.

0
 
LVL 17

Expert Comment

by:Barry Cunney
ID: 36950961
Hi Steve,
Try this
DoCmd.OpenForm stDocName, acNormal, , "[Type] = 'P'", acFormEdit, acWindowNormal
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

850 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