Another WHERE statement problem

Tyler08

Registered User.
Local time
Today, 10:00
Joined
Feb 27, 2008
Messages
44
Afternoon all

I'm trying to open a report based on a selection in a Combo drop down on a form.

The report lists shifts booked by operatives to various contracts and I want to limit the results to the contract selected.

I get the error message:

Run Time Error '3075'
Syntax error in Query Expression '([QryShifts].[ContractNo]='BE-50';)'.

I'm using the code:

Private Sub CboSelectContract_AfterUpdate()

Dim StrRepName As String 'Report Name'
Dim StrWhereStr As String 'Where Condition'
Dim StrCboSelection As String 'Selection from drop down list

StrCboSelection = CboSelectContract.Value
StrRepName = "RepSteve"
StrWhereStr = "[QryShifts].[ContractNo] ='" & StrCboSelection & "';"

DoCmd.OpenReport StrRepName, acPreview, , StrWhereStr

End Sub

I think the fault lies in my WHERE statement.

Can anyone see what I'm doing wrong?

Tyler
 
StrWhereStr = "[QryShifts].[ContractNo] ='" & StrCboSelection & "';"

The semi column is not supposed to be there !
 
Bloody hell, I've been scratching my head with this all morning!

And the odd thing is that the ';' converted to a wink in the post and I still didn't spot it!

The report works lovely now. Thanks geezer.

Tyler
 
That's funny cause i was gonna say - It'll be the smileys fault!
:)
 

Users who are viewing this thread

Back
Top Bottom