Open report statement

J

JH

I am having a lot of problem with the following "SQL" statement, can someone
please help me resolve this? It is the Prov part that is generating the
error,
Thanks!

------------------------------------------------------------------------------------
Dim Mth As Date
Dim Prov As String


Prov = "BC"
Mth = #2/1/2007#
SQL = "[Monthly Test Details]![Billing period]=" & "#" & Mth & "#" & _
" And [Monthly Test Details]![Province]=" & Prov

On Error GoTo period_Err

DoCmd.OpenReport "Provincial Billing Statement", acPreview, "", SQL
 
O

Ofer Cohen

When you use text as filter you need to add single quote before and after the
value.

Try
SQL = "[Monthly Test Details]![Billing period]= #" & Mth & "# And [Monthly
Test Details]![Province]='" & Prov & "'"

DoCmd.OpenReport "Provincial Billing Statement", acPreview, , SQL
 
Top