Solved

Access 2010 run time error 3464

Posted on 2014-10-25
4
284 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 49

Accepted Solution

by:
Gustav Brock earned 500 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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

821 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