PC Review


Reply
Thread Tools Rate Thread

Calling report from form that uses Dlookup

 
 
=?Utf-8?B?TGluZGE=?=
Guest
Posts: n/a
 
      16th May 2007
I have a form that I have saved as a report. I would like to put a button on
the form to print the report. How do I launch the report from the form
button? There are some fields filled using DLookup on the form. They show
up as #Error on the report. What might be causing that? Also, how can I
limit the print to just the record the print report is selected in? Thanks
in advance for any help you can provide.
--
Linda
 
Reply With Quote
 
 
 
 
Carl Rapson
Guest
Posts: n/a
 
      16th May 2007
"Linda" <(E-Mail Removed)> wrote in message
news:00C4C14A-1D4E-4216-8EC1-(E-Mail Removed)...
>I have a form that I have saved as a report. I would like to put a button
>on
> the form to print the report. How do I launch the report from the form
> button? There are some fields filled using DLookup on the form. They
> show
> up as #Error on the report. What might be causing that? Also, how can I
> limit the print to just the record the print report is selected in?
> Thanks
> in advance for any help you can provide.
> --
> Linda


In the Click event of the button, call DoCmd.OpenReport:

DoCmd.OpenReport "name you gave the report"

To filter the report, specify the criteria in the WhereCondition parameter
of the OpenReport call:

DoCmd.OpenReport "name you gave the report",,,"[ID]=" & Me.ID

The field you use for the criteria should be the primary key of the record,
if possible. I used ID as a dummy field because I don't know the names of
your fields.

I'm not sure about the problem with DLookUp. I've never saved a form as a
report; I always create reports directly from my tables and queries. My
guess would be that the DLookUp calls are referring to a control or field
that is on the form but not on the report. What do your DLookUp calls look
like?

Carl Rapson


 
Reply With Quote
 
=?Utf-8?B?TGluZGE=?=
Guest
Posts: n/a
 
      16th May 2007
You are right in that the DLookup calls refer to a control on the form. In
reading one of the other threads they said the form controls would be
available to the report launched from the form. Here is an example of one of
my DLookup calls:
=DLookUp("[RequirementDescription]","[GBDRequirementsTbl]","[ReqNum] =
Forms!TestMatrixFrm![RequirementNumbertxt]")
--
Linda


"Carl Rapson" wrote:

> "Linda" <(E-Mail Removed)> wrote in message
> news:00C4C14A-1D4E-4216-8EC1-(E-Mail Removed)...
> >I have a form that I have saved as a report. I would like to put a button
> >on
> > the form to print the report. How do I launch the report from the form
> > button? There are some fields filled using DLookup on the form. They
> > show
> > up as #Error on the report. What might be causing that? Also, how can I
> > limit the print to just the record the print report is selected in?
> > Thanks
> > in advance for any help you can provide.
> > --
> > Linda

>
> In the Click event of the button, call DoCmd.OpenReport:
>
> DoCmd.OpenReport "name you gave the report"
>
> To filter the report, specify the criteria in the WhereCondition parameter
> of the OpenReport call:
>
> DoCmd.OpenReport "name you gave the report",,,"[ID]=" & Me.ID
>
> The field you use for the criteria should be the primary key of the record,
> if possible. I used ID as a dummy field because I don't know the names of
> your fields.
>
> I'm not sure about the problem with DLookUp. I've never saved a form as a
> report; I always create reports directly from my tables and queries. My
> guess would be that the DLookUp calls are referring to a control or field
> that is on the form but not on the report. What do your DLookUp calls look
> like?
>
> Carl Rapson
>
>
>

 
Reply With Quote
 
Carl Rapson
Guest
Posts: n/a
 
      16th May 2007
As long as the form is still open, the controls should be available.
Unfortunately, I don't have any experience with referring to form controls
from a report; perhaps someone else does and can jump in here. One thing you
might try is to change it to look something like this:

=DLookUp("[RequirementDescription]","[GBDRequirementsTbl]","[ReqNum] = " &
Forms!TestMatrixFrm![RequirementNumbertxt])

In other words, concatenate the value from the form onto the string. I can't
guarantee this will work, however. Sorry I can't be of more help.

Carl Rapson

"Linda" <(E-Mail Removed)> wrote in message
news:84A5F699-BDB2-44D3-8C51-(E-Mail Removed)...
> You are right in that the DLookup calls refer to a control on the form.
> In
> reading one of the other threads they said the form controls would be
> available to the report launched from the form. Here is an example of one
> of
> my DLookup calls:
> =DLookUp("[RequirementDescription]","[GBDRequirementsTbl]","[ReqNum] =
> Forms!TestMatrixFrm![RequirementNumbertxt]")
> --
> Linda
>
>
> "Carl Rapson" wrote:
>
>> "Linda" <(E-Mail Removed)> wrote in message
>> news:00C4C14A-1D4E-4216-8EC1-(E-Mail Removed)...
>> >I have a form that I have saved as a report. I would like to put a
>> >button
>> >on
>> > the form to print the report. How do I launch the report from the form
>> > button? There are some fields filled using DLookup on the form. They
>> > show
>> > up as #Error on the report. What might be causing that? Also, how can
>> > I
>> > limit the print to just the record the print report is selected in?
>> > Thanks
>> > in advance for any help you can provide.
>> > --
>> > Linda

>>
>> In the Click event of the button, call DoCmd.OpenReport:
>>
>> DoCmd.OpenReport "name you gave the report"
>>
>> To filter the report, specify the criteria in the WhereCondition
>> parameter
>> of the OpenReport call:
>>
>> DoCmd.OpenReport "name you gave the report",,,"[ID]=" & Me.ID
>>
>> The field you use for the criteria should be the primary key of the
>> record,
>> if possible. I used ID as a dummy field because I don't know the names of
>> your fields.
>>
>> I'm not sure about the problem with DLookUp. I've never saved a form as a
>> report; I always create reports directly from my tables and queries. My
>> guess would be that the DLookUp calls are referring to a control or field
>> that is on the form but not on the report. What do your DLookUp calls
>> look
>> like?
>>
>> Carl Rapson
>>
>>
>>



 
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
Use dlookup in report with calculated field in form Basenji Microsoft Access Reports 2 18th Nov 2009 09:10 PM
DLookup to bring report totals into form controls CW Microsoft Access 3 28th Feb 2009 03:49 PM
Using DLookUp and Date form to generate report artist02 via AccessMonster.com Microsoft Access Reports 0 18th Oct 2006 12:14 PM
Please Help: Using DLookUp and Date form for report artist02 via AccessMonster.com Microsoft Access Reports 0 13th Oct 2006 11:08 AM
Dlookup works on Form but not on Report =?Utf-8?B?TG9yaUZyb21CdWZmYWxv?= Microsoft Access Reports 2 12th Apr 2005 09:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:23 PM.