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

x
?
Solved

Access 2010 Run-Time Error 3075

Posted on 2014-10-10
6
Medium Priority
?
244 Views
Last Modified: 2014-10-10
I'm using the code below and get error code 3075 -- Syntax error (missing operator) in query expression '[Budgetary_Dr]='(4287001',45900001'). Any Thoughts

Dim strList As String


strList = "('" & Replace(Me.Budgetary_DR, " ", "','") & "')"

If DCount("*", "tbl_USSGL", "[Budgetary_DR]='" & strList & "'") = 0 Then
     MsgBox "No related record found", vbExclamation, "ATM"
     Exit Sub
 Else
End If
DoCmd.OpenForm "frm_USSGL", , , "[USSGL Child] In " & strList
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
  • 2
  • 2
6 Comments
 
LVL 22

Expert Comment

by:rspahitz
ID: 40373439
Looks like the quotes are mis-aligned:

'[Budgetary_Dr]='(4287001',45900001')

maybe this?

[Budgetary_Dr]='(4287001,45900001)'
?

To help out, just before the DoCmd, put this:

Debug.Print strList

And you can look in the Immediate window (open from the View menu) and you'll see the value.
Or set a breakpoint there and examine strList to ensure that it's correct.
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 40373453
Another thought is to take the DCount, DCount("*", "tbl_USSGL", "[Budgetary_DR]='" & strList & "'")
And turn it into a query to make sure it works, something like:

SELECT * from tbl_USSGL
WHERE [Budgetary_DR]=' {contents of strList} '

test that in the query builder
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 40373537
first check strList values to be in this format

'4287001','45900001'

values are wrapped in single quotes (')

then use this syntax

If DCount("*", "tbl_USSGL", "[Budgetary_DR] In (" & strList & ")") = 0 Then


----

DoCmd.OpenForm "frm_USSGL", , , "[USSGL Child] In (" & strList & ")"
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 total points
ID: 40373601
correction..

strList = "('" & Replace(Me.Budgetary_DR, " ", "','") & "')"
'add the line below to check the format of strList

debug.print strList

the result should be

('4287001','45900001')

so change the syntax i posted above with

If DCount("*", "tbl_USSGL", "[Budgetary_DR] In " & strList) = 0 Then

----

DoCmd.OpenForm "frm_USSGL", , , "[USSGL Child] In " & strList
0
 

Author Comment

by:shieldsco
ID: 40373657
Rey - run time error 2471 The expression you entered as a query parameter produced tis error: '[Budgetary_DR]''

If DCount("*", "tbl_USSGL", "[Budgetary_DR] In " & strList) = 0 Then
0
 

Author Closing Comment

by:shieldsco
ID: 40373701
Very Good
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
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.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

661 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