Solved

Access 2010 run time error 3464

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
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.

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now