Solved

Access 2010 Run-Time Error 3075

Posted on 2014-10-10
6
229 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
  • 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 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

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.

Question has a verified solution.

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

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…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
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