Solved

Access 2010 run time error 3464

Posted on 2014-10-25
4
292 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 51

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
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…

621 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