Solved

3 where conditions

Posted on 2014-03-21
7
207 Views
Last Modified: 2014-03-27
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.
0
Comment
Question by:Stephen Byrom
  • 5
  • 2
7 Comments
 
LVL 48

Expert Comment

by:Rgonzo1971
ID: 39947027
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
 
LVL 1

Author Comment

by:Stephen Byrom
ID: 39947105
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
 
LVL 1

Author Comment

by:Stephen Byrom
ID: 39947115
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 48

Expert Comment

by:Rgonzo1971
ID: 39947139
Hi,

Maybe the date makes problem.

try

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

Open in new window


Regards
0
 
LVL 1

Author Comment

by:Stephen Byrom
ID: 39947165
Nahh,
Still errors out (no data).
0
 
LVL 1

Accepted Solution

by:
Stephen Byrom earned 0 total points
ID: 39947168
It may be the report that's the problem, rather than the calling procedure.
I'll have a mooch around
0
 
LVL 1

Author Closing Comment

by:Stephen Byrom
ID: 39958389
sorry for wasting your time, there was a query feeding the report which I was not aware of.
Thanks for your input though
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now