PC Review


Reply
Thread Tools Rate Thread

Code to Launch report from form problem

 
 
smcgrath via AccessMonster.com
Guest
Posts: n/a
 
      30th Nov 2006
I am using the following code on a form to print a report - I would like to
select a processor and have all of their accounts show on the report. Query
is working fine but when I preview the report with this code, I have a blank
report. processor Initials is a text field-Do I have the quotes messed up?
No matter what I change them to I get no results on the report. Any ideas?


Dim StrWhere As String

'Select Processor
If IsNull(cboInit) = False Then
If StrWhere <> "" Then
StrWhere = StrWhere & " and "
End If
StrWhere = StrWhere & "processorInit = '" & cboInit & "'"
DoCmd.OpenReport "RptToBeDischarged", acViewPreview, , StrWhere
End If

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200611/1

 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      30th Nov 2006
You sure cboInit is returning what you think it is?

Try putting a MsgBox StrWhere just before your DoCmd.OpenReport statement.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"smcgrath via AccessMonster.com" <u10749@uwe> wrote in message
news:6a1096335df2f@uwe...
>I am using the following code on a form to print a report - I would like to
> select a processor and have all of their accounts show on the report.
> Query
> is working fine but when I preview the report with this code, I have a
> blank
> report. processor Initials is a text field-Do I have the quotes messed
> up?
> No matter what I change them to I get no results on the report. Any
> ideas?
>
>
> Dim StrWhere As String
>
> 'Select Processor
> If IsNull(cboInit) = False Then
> If StrWhere <> "" Then
> StrWhere = StrWhere & " and "
> End If
> StrWhere = StrWhere & "processorInit = '" & cboInit & "'"
> DoCmd.OpenReport "RptToBeDischarged", acViewPreview, , StrWhere
> End If
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/For...ccess/200611/1
>



 
Reply With Quote
 
Jesse
Guest
Posts: n/a
 
      30th Nov 2006
As Mr. Steele said, check cbolnit (make sure that it is spelled
correctly) and that it is not defined as a number (long, integer,
etc.). If it is defined as a number, the quotes will need to be
eliminated and replaced as follows:
StrWhere = StrWhere & "processorInit = " & cboInit

On Nov 30, 10:52 am, "smcgrath via AccessMonster.com" <u10749@uwe>
wrote:
> I am using the following code on a form to print a report - I would like to
> select a processor and have all of their accounts show on the report. Query
> is working fine but when I preview the report with this code, I have a blank
> report. processor Initials is a text field-Do I have the quotes messed up?
> No matter what I change them to I get no results on the report. Any ideas?
>
> Dim StrWhere As String
>
> 'Select Processor
> If IsNull(cboInit) = False Then
> If StrWhere <> "" Then
> StrWhere = StrWhere & " and "
> End If
> StrWhere = StrWhere & "processorInit = '" & cboInit & "'"
> DoCmd.OpenReport "RptToBeDischarged", acViewPreview, , StrWhere
> End If
>
> --
> Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/access/200611/1


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access prints the form from wich the report is launch intead of th michelangelo Microsoft Access Reports 1 8th Oct 2009 05:03 AM
How to launch Macro/Code form command line Phil Smith Microsoft Excel Programming 2 5th Apr 2009 10:02 PM
Can I launch a form from a report? Jordan Microsoft Access Getting Started 6 20th Jun 2008 04:37 PM
Problem with Custom Toolbar when opening a report from code within a Form cjmacs@cjmacs.com Microsoft Access Reports 1 22nd May 2006 07:38 PM
Open report from form, then wait til report is closed before running rest of code? Jason Gyetko Microsoft Access Forms 1 5th Mar 2004 03:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:06 PM.