Solved

3 where conditions

Posted on 2014-03-21
7
225 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Suggested Solutions

Title # Comments Views Activity
Many to Many From without subform 11 48
Access syntax 1 35
Null or "" 28 53
Email question 12 25
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

730 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