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
 

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