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
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