3 where conditions

HI,
I have tried for a while but cannot get this to open a report;
    DoCmd.OpenReport "rptASN", acViewPreview, , "[fkcustid] = " & Me.cboCustomer & " And TrailerNum = '" & Me.TNum & "'" And "[DelDate] = #" & Me.txtDelDate & "#"

Can anyone see where the error is? I am beginning to lose the will to live here.
LVL 1
Stephen ByromWarehouse/ShippingAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Stephen ByromConnect With a Mentor Warehouse/ShippingAuthor Commented:
It may be the report that's the problem, rather than the calling procedure.
I'll have a mooch around
0
 
Rgonzo1971Commented:
HI,

pls try

Debug.Print "[fkcustid] = " & Me.cboCustomer & " And TrailerNum = '" & Me.TNum & "'" & " And [DelDate] = #" & Me.txtDelDate & "#"

Open in new window

Regards

but are you sure the TNum should be in(' ')

Regards
0
 
Stephen ByromWarehouse/ShippingAuthor Commented:
Hi, Thanks for the response.
When I run it, the correct parameters are displayed in the immediate window, and the TNum refers to trailer numbers which are alphanumeric, so I placed the single apostrophes around it.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Stephen ByromWarehouse/ShippingAuthor Commented:
Here's the procedure without ErrorHandler

Private Sub btnASN_Click()
Dim strDoc As String
Dim strWhere As String
strWhere = "[fkcustid] = " & Me.cboCustomer & " And TrailerNum = '" & Me.TNum & "'" & " And [DelDate] = #" & Me.txtDelDate & "#"

Select Case Me.cboCustomer
    Case 169, 300
        strDoc = "RvwCKnote"
    Case 329
        strDoc = "RvwToyNote"
    Case 444
        strDoc = "RvwToyUKnote"
    Case 238
        strDoc = "RvwHonNotw"
    Case Else
        strDoc = "rptASN3"
End Select
   
    DoCmd.OpenReport strDoc, acViewPreview, , strWhere
   
End Sub
0
 
Rgonzo1971Commented:
Hi,

Maybe the date makes problem.

try

#" & Format(Me.txtDelDate , "mm/dd/yyyy") & "#")

Open in new window


Regards
0
 
Stephen ByromWarehouse/ShippingAuthor Commented:
Nahh,
Still errors out (no data).
0
 
Stephen ByromWarehouse/ShippingAuthor Commented:
sorry for wasting your time, there was a query feeding the report which I was not aware of.
Thanks for your input though
0
All Courses

From novice to tech pro — start learning today.