Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Access 2010 run time error 3464

Posted on 2014-10-25
4
Medium Priority
?
298 Views
Last Modified: 2014-10-25
I'm using the code below and I get a run time error 3464 Data Type Mismatch in Criteria Expression:
DoCmd.OpenForm "frm_fund_Groups", , , "[Fund Type Code] in(" & strFund & ")"

The data in the field is in the following format.... CF/DF/EC/EG/EM/EP/ER/ES/ET/GA/TR/UG/US/UT

Any Thoughts.. Thanks



Dim strFund As String, j As Integer, fundArr() As String
If InStr(Me.FundType, "/") Then
    fundArr = Split(Me.FundType, "/")
    For j = 0 To UBound(fundArr)
        strFund = strFund & "/" & Chr(39) & fundArr(j) & Chr(39)
    Next
    Else
    strFund = Chr(39) & Me.FundType & Chr(39)
End If
If InStr(strFund, "/") Then
    strFund = Mid(strFund, 2)
End If

DoCmd.OpenForm "frm_fund_Groups", , , "[Fund Type Code] in(" & strFund & ")"
0
Comment
Question by:shieldsco
  • 2
4 Comments
 
LVL 52

Accepted Solution

by:
Gustav Brock earned 2000 total points
ID: 40404351
IN works with commas:

  strFund = strFund & "," & Chr(39) & fundArr(j) & Chr(39)

/gustav
0
 

Author Comment

by:shieldsco
ID: 40404359
When I change to strFund = strFund & "," & Chr(39) & fundArr(j) & Chr(39)
Run Time Error 3075 Syntax Error (missing operator) in query expression 'Fund Type Code] in (,'EC','EG','EM')',

DoCmd.OpenForm "frm_fund_Groups", , , "[Fund Type Code] in(" & strFund & ")"
0
 

Author Closing Comment

by:shieldsco
ID: 40404374
Thanks
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 40404378
You need to remove the beginning comma so you should change the code of the second IF statement to:
If InStr(strFund, ",") Then

However, I believe your code could be simplified to just this:
 
Dim strFund As String

strFund = Replace(Me.FundType, "/","','")
DoCmd.OpenForm "frm_fund_Groups", , , "[Fund Type Code] in(" & strFund & ")" 

Open in new window

Ron
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
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…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

782 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