PC Review


Reply
Thread Tools Rate Thread

DLookUp for an unbound control on a form

 
 
Linda \(RQ\)
Guest
Posts: n/a
 
      1st Feb 2007
Hi Everyone,

I have an unbound control on a form in Access 2003. The one DLookUp
expression from a query below works. I added an expression on the same
query and was hoping it would work the same way but I don't know what to do
with the brackets, quotations or commas.

SELECT qryCountOfProtocolTreatments.CountOfPtThpyID,
qryCountOfAllTreatments.CountOfPtThpyID,
[qryCountOfProtocolTreatments.CountOfPtThpyID]/[qryCountOfAllTreatments.CountOfPtThpyID]
AS ProtocolTreatmentPercent
FROM qryCountOfProtocolTreatments, qryCountOfAllTreatments;


=DLookUp("CountOfPtThpyID","qryCountOfAllTreatments")
The above works perfectly.

=DLookUp("ProtocolTreatmentPercent:
[qryCountOfProtocolTreatments.CountOfPtThpyID]/[qryCountOfAllTreatments.CountOfPtThpyID]")
The above and an additional 20 or so variations does not work...I need help
on this.

Thanks,
Linda


 
Reply With Quote
 
 
 
 
=?Utf-8?B?RGFtaWFuIFM=?=
Guest
Posts: n/a
 
      1st Feb 2007
Hi Linda,

Almost there... try this:

=DLookUp("[qryCountOfProtocolTreatments.CountOfPtThpyID]/[qryCountOfAllTreatments.CountOfPtThpyID]", "QUERYNAME")

Where QUERYNAME is the name of the query where the two subqueries are linked.

Of course, this assumes that these values won't be zero... you might need
to check for that and handle it, but this fixes your dlookup issue.

Another way would be to do it separately like this:
=DLookUp("[CountOfPtThpyID]",
"qryCountOfProtocolTreatments")/dlookup([CountOfPtThpyID]",
"qryCountOfAllTreatments")

Damian.

"Linda (RQ)" wrote:

> Hi Everyone,
>
> I have an unbound control on a form in Access 2003. The one DLookUp
> expression from a query below works. I added an expression on the same
> query and was hoping it would work the same way but I don't know what to do
> with the brackets, quotations or commas.
>
> SELECT qryCountOfProtocolTreatments.CountOfPtThpyID,
> qryCountOfAllTreatments.CountOfPtThpyID,
> [qryCountOfProtocolTreatments.CountOfPtThpyID]/[qryCountOfAllTreatments.CountOfPtThpyID]
> AS ProtocolTreatmentPercent
> FROM qryCountOfProtocolTreatments, qryCountOfAllTreatments;
>
>
> =DLookUp("CountOfPtThpyID","qryCountOfAllTreatments")
> The above works perfectly.
>
> =DLookUp("ProtocolTreatmentPercent:
> [qryCountOfProtocolTreatments.CountOfPtThpyID]/[qryCountOfAllTreatments.CountOfPtThpyID]")
> The above and an additional 20 or so variations does not work...I need help
> on this.
>
> Thanks,
> Linda
>
>
>

 
Reply With Quote
 
 
 
 
Linda \(RQ\)
Guest
Posts: n/a
 
      4th Feb 2007
Thanks, Damian,

This is cool stuff! I still don't know what the heck it means but I can
just copy and past qry names and field names to do the same thing in other
projects I have. I have also learned that I can't get a percent expressed
on a query but I just expressed this number as a percent on my form.......So
much to remember!


Linda

"Damian S" <(E-Mail Removed)> wrote in message
news:3B2D6EE2-DD5A-4368-9951-(E-Mail Removed)...
> Hi Linda,
>
> Almost there... try this:
>
> =DLookUp("[qryCountOfProtocolTreatments.CountOfPtThpyID]/[qryCountOfAllTreatments.CountOfPtThpyID]",
> "QUERYNAME")
>
> Where QUERYNAME is the name of the query where the two subqueries are
> linked.
>
> Of course, this assumes that these values won't be zero... you might need
> to check for that and handle it, but this fixes your dlookup issue.
>
> Another way would be to do it separately like this:
> =DLookUp("[CountOfPtThpyID]",
> "qryCountOfProtocolTreatments")/dlookup([CountOfPtThpyID]",
> "qryCountOfAllTreatments")
>
> Damian.
>
> "Linda (RQ)" wrote:
>
>> Hi Everyone,
>>
>> I have an unbound control on a form in Access 2003. The one DLookUp
>> expression from a query below works. I added an expression on the same
>> query and was hoping it would work the same way but I don't know what to
>> do
>> with the brackets, quotations or commas.
>>
>> SELECT qryCountOfProtocolTreatments.CountOfPtThpyID,
>> qryCountOfAllTreatments.CountOfPtThpyID,
>> [qryCountOfProtocolTreatments.CountOfPtThpyID]/[qryCountOfAllTreatments.CountOfPtThpyID]
>> AS ProtocolTreatmentPercent
>> FROM qryCountOfProtocolTreatments, qryCountOfAllTreatments;
>>
>>
>> =DLookUp("CountOfPtThpyID","qryCountOfAllTreatments")
>> The above works perfectly.
>>
>> =DLookUp("ProtocolTreatmentPercent:
>> [qryCountOfProtocolTreatments.CountOfPtThpyID]/[qryCountOfAllTreatments.CountOfPtThpyID]")
>> The above and an additional 20 or so variations does not work...I need
>> help
>> on this.
>>
>> Thanks,
>> Linda
>>
>>
>>



 
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
I have a problem with Dlookup via an unbound control on report =?Utf-8?B?ZWZhbmRhbmdv?= Microsoft Access Reports 6 6th Feb 2007 11:10 PM
Unbound form/unbound control calculation =?Utf-8?B?Q2hyaXM=?= Microsoft Access Form Coding 2 30th Sep 2005 08:10 PM
Trigger event on change to unbound text in unbound form programmat =?Utf-8?B?QWJlUg==?= Microsoft Access Forms 5 6th Jan 2005 08:33 PM
Unbound Form controls Unbound Form Gérard Marcillac Microsoft Access Forms 0 28th Jun 2004 04:07 PM
Default Value for unbound text box and unbound form: 1 Microsoft Access Form Coding 0 3rd Sep 2003 02:03 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:02 AM.