Report by date problem

  • Thread starter tspies85 via AccessMonster.com
  • Start date
T

tspies85 via AccessMonster.com

Hi ,
i do have the same idea of creating a report. i've tried your way.. and this
error message came up

Run-time error '3075'

Invalid use of vertical bars in query expression ......

... this is my code...

Private Sub Command5_Click()
Dim strWhere As String
strWhere = "|=|"
If Not IsNull(Me.startDate) Then
strWhere = strWhere & "And [TarikhDaftar] >=# " & _
Me.startDate & "#"
End If
If Not IsNull(Me.endDate) Then
strWhere = strWhere & "And[TarikhDaftar] <=# " & _
Me.endDate & "#"
End If
DoCmd.OpenReport "Laporan Harta Semasa", acPreview, , strWhere
 
G

Guest

The line should be one = one
strWhere = "1=1 "

You should also remove the space following the #
strWhere = strWhere & "And [TarikhDaftar] >=#" & _
 

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