Syntax Error

C

Cuda

I'm receiving a "Syntax error in string in query expression
'(ProjectNo=MC-6100") for the following:

Dim stDocName As String
Dim strCurrent As String
strCurrent = Me!ProjectNo & Chr(34)

stDocName = "Project Information"
DoCmd.OpenReport stDocName, acPreview, WhereCondition:="ProjectNo=" &
strCurrent

The project number is MC-6100
 
T

Tom Lake

Cuda said:
I'm receiving a "Syntax error in string in query expression
'(ProjectNo=MC-6100") for the following:

Dim stDocName As String
Dim strCurrent As String
strCurrent = Me!ProjectNo & Chr(34)

stDocName = "Project Information"
DoCmd.OpenReport stDocName, acPreview, WhereCondition:="ProjectNo=" &
strCurrent

The project number is MC-6100

You only have one Chr(34) in strCurrent.

Try this:

strCurrent = "'" & Me!ProjectNo & "'"

Tom Lake
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top