|
 |
access thread: Printing Report from a Form
Message #1 by "wambui njoroge" <kagdw189@b...> on Tue, 24 Sep 2002 23:56:27
|
|
I have a form and would like to print a report that corresponds to the
current record. Here's my code:
Private Sub cmdPrint_Click()
Dim strDocName As String
Dim strFilter As String
strDocName = "ApplicantReport"
strFilter = "ApplicantID = Forms!Applicants!ApplicantID"
DoCmd.OpenReport "ApplicantReport", acViewNormal, , strFilter
End Sub
I'm getting a blank report with no data. What's wrong with my code?
Thanks.
Wambui
Message #2 by "John Ruff" <papparuff@c...> on Tue, 24 Sep 2002 17:10:38 -0700
|
|
Change your DoCmd.OpenReport to this:
DoCmd.OpenReport "ApplicantReport", acViewNormal, , "ApplicantID=" &
me.ApplicantID
John V. Ruff - The Eternal Optimist :-)
Always Looking For Contract Opportunities
www.noclassroom.com
Live software training
Right over the Internet
Home: xxx.xxx.xxxx
Cell: xxx.xxx.xxxx
9306 Farwest Dr SW
Lakewood, WA 98498
"Commit to the Lord whatever you do,
and your plans will succeed." Proverbs 16:3
-----Original Message-----
From: wambui njoroge [mailto:kagdw189@b...]
Sent: Tuesday, September 24, 2002 11:56 PM
To: Access
Subject: [access] Printing Report from a Form
I have a form and would like to print a report that corresponds to the
current record. Here's my code:
Private Sub cmdPrint_Click()
Dim strDocName As String
Dim strFilter As String
strDocName = "ApplicantReport"
strFilter = "ApplicantID = Forms!Applicants!ApplicantID"
DoCmd.OpenReport "ApplicantReport", acViewNormal, , strFilter End
Sub
I'm getting a blank report with no data. What's wrong with my code?
Thanks.
Wambui
Message #3 by John Fejsa <John.Fejsa@h...> on Wed, 25 Sep 2002 12:34:40 +1000
|
|
Try changing your filter line from
strFilter = "ApplicantID = Forms!Applicants!ApplicantID"
to
strFilter = "ApplicantID = " & Forms!Applicants!ApplicantID
That should do it.
____________________________________________________
John Fejsa
Systems Analyst/Computer Programmer
Hunter Centre for Health Advancement
Locked Bag 10, WALLSEND NSW 2287
Phone: (02) 4924 6336 Fax: (02) 4924 6209
www.hcha.org.au
____________________________________________________
The doors we open and close each day decide the lives we live
____________________________________________________
CONFIDENTIALITY & PRIVILEGE NOTICE
The information contained in this email message is intended for the named addressee only. If you are not the intended recipient you
must not copy, distribute, take any action reliant on, or disclose any details of the information in this email to any other person
or organisation. If you have received this email in error please notify us immediately.
>>> kagdw189@b... 25/09/2002 9:56:27 >>>
I have a form and would like to print a report that corresponds to the
current record. Here's my code:
Private Sub cmdPrint_Click()
Dim strDocName As String
Dim strFilter As String
strDocName = "ApplicantReport"
strFilter = "ApplicantID = Forms!Applicants!ApplicantID"
DoCmd.OpenReport "ApplicantReport", acViewNormal, , strFilter
End Sub
I'm getting a blank report with no data. What's wrong with my code?
Thanks.
Wambui
Message #4 by "Gregory Serrano" <SerranoG@m...> on Wed, 25 Sep 2002 13:21:29
|
|
Wambui,
You must change:
strFilter = "ApplicantID = Forms!Applicants!ApplicantID"
To
strFilter = "ApplicantID = " & Forms!Applicants!ApplicantID
if ApplicantID is a number, or to
strFilter = "ApplicantID = '" & Forms!Applicants!ApplicantID & "'"
if ApplicantID is a string.
Greg
|
|
 |