?
Solved

Help with VBA Code in Access 2010

Posted on 2012-08-29
2
Medium Priority
?
576 Views
Last Modified: 2012-08-29
Hi. I have following code below.  Purpose is to open the form "Financial-Table form-PO".  I would like to use as a filter (2 queries): "qryInputForm-CLOSED",
"qryInputForm-CLOSED-before conversion".

How can i modify below listed code?

I changed lines

stfilter="qryInputForm-CLOSED-before conversion"
 DoCmd.OpenForm stDocName, stfilter, , stLinkCriteria

However, I got an error "type mismatch"

Please see the code below (before adjustments)

Dim stDocName As String
    Dim stLinkCriteria As String
    Dim stfilter As String
    Caption = "PAID LOANS MODE AFTER CONVERSION"
    stDocName = "Financial-Table form-PO"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Open in new window

0
Comment
Question by:maximyshka
2 Comments
 
LVL 13

Accepted Solution

by:
lee555J5 earned 2000 total points
ID: 38347307
The filter should be the third argument for DoCmd.OpenForm, not the second.

The line should read:
DoCmd.OpenForm stDocName, , stfilter, stLinkCriteria

I would delete the stLinkCriteria if you're not using it.

Also, you may need to enclose your query name in [ ] because of the space.
stfilter="[qryInputForm-CLOSED-before conversion]"

Lee
0
 

Author Closing Comment

by:maximyshka
ID: 38347365
Thanks Lee
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

Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
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.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
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