If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
WhereCondition
I have this statement in a VBA code and it is not working. Can anyone
provide assistance. Thanks. DoCmd.OpenReport "rptBillingStatement", acViewPreview, , "agNumber = " & Me.[txtAgencyNo] The problem lies with the WhereCondition Statement. I have never used this before and I'm having problems getting it to work. agNumber=Agent Number on the report txtAgencyNo = Agent Number on the form, which they enter before pressing a "View Report" Command button Thanks. |
#2
|
|||
|
|||
On Wed, 18 Aug 2004 12:05:03 -0700, Ed the Redhead wrote:
I have this statement in a VBA code and it is not working. Can anyone provide assistance. Thanks. DoCmd.OpenReport "rptBillingStatement", acViewPreview, , "agNumber = " & Me.[txtAgencyNo] The problem lies with the WhereCondition Statement. I have never used this before and I'm having problems getting it to work. agNumber=Agent Number on the report txtAgencyNo = Agent Number on the form, which they enter before pressing a "View Report" Command button Thanks. The code is OK IF... agNumber is a Number datatype. However, if agNumber is a Text datatype then use: DoCmd.OpenReport "rptBillingStatement", acViewPreview, , "agNumber = '" & Me![txtAgencyNo] & "'" -- Fred Please only reply to this newsgroup. I do not reply to personal email. |
#3
|
|||
|
|||
Ed, Change your Where statement as follows and make sure that you do
have a control on your report named [agNumber]. If agNumber is a number: "[agNumber] =" & Me.[txtAgencyNo] If agNumber is a text field: "[agNumber] ='" & Me.[txtAgencyNo] & "'" If agNumber is a date field (which I doubt): "[agNumber] =#" & Me.[txtAgencyNo] & "#" Hope this helps! Reggie Ed the Redhead wrote: I have this statement in a VBA code and it is not working. Can anyone provide assistance. Thanks. DoCmd.OpenReport "rptBillingStatement", acViewPreview, , "agNumber = " & Me.[txtAgencyNo] The problem lies with the WhereCondition Statement. I have never used this before and I'm having problems getting it to work. agNumber=Agent Number on the report txtAgencyNo = Agent Number on the form, which they enter before pressing a "View Report" Command button Thanks. |
#4
|
|||
|
|||
Thank you so much. It works now. This was the last thing I needed to put
this project to bed! "Reggie" wrote: Ed, Change your Where statement as follows and make sure that you do have a control on your report named [agNumber]. If agNumber is a number: "[agNumber] =" & Me.[txtAgencyNo] If agNumber is a text field: "[agNumber] ='" & Me.[txtAgencyNo] & "'" If agNumber is a date field (which I doubt): "[agNumber] =#" & Me.[txtAgencyNo] & "#" Hope this helps! Reggie Ed the Redhead wrote: I have this statement in a VBA code and it is not working. Can anyone provide assistance. Thanks. DoCmd.OpenReport "rptBillingStatement", acViewPreview, , "agNumber = " & Me.[txtAgencyNo] The problem lies with the WhereCondition Statement. I have never used this before and I'm having problems getting it to work. agNumber=Agent Number on the report txtAgencyNo = Agent Number on the form, which they enter before pressing a "View Report" Command button Thanks. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
WhereCondition ignored when MS Access Form invokes Report | yisraelharris | Using Forms | 1 | June 1st, 2004 01:24 PM |