Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access 2010 run time error 3464

Posted on 2014-10-25
4
Medium Priority
?
295 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 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
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…
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.

688 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