Solved

3 where conditions

Posted on 2014-03-21
7
216 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 49

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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 49

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Add records to a form to a table 11 41
Combobox row source 2 20
Access Crosstab Query with Multiple Values 4 32
Dirty form - conditional formatting 5 25
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…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

777 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