Code to Launch report from form problem

  • Thread starter smcgrath via AccessMonster.com
  • Start date
S

smcgrath via AccessMonster.com

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
 
D

Douglas J. Steele

You sure cboInit is returning what you think it is?

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

Jesse

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top