Solved

3 where conditions

Posted on 2014-03-21
7
224 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 50

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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
LVL 50

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

839 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