Trying to reference a field in a querry to use in calculation on f

F

FatMan

Hi all:
Can anyone please help me with this.

I need to reefer to a field from a MS Access query (the query has been
created using the query by example grid and not SQL) on a form. The field
name is "BinQty" and shows up as "SumOfBinQty" as the Groupby and sum options
are bing used.

When I reefer to the field in VBA I get the error message "Object Required".
I reefer to the field as:
Queries![qryPackoutPreviousPackoutsSum].[SumOfBinQty]

What is wrong?

The background to this is that I am trying to check to see if the total of
BinQty exceeds the value of BinsIntake. The querry is calculating the
SumOfBinQty correctly but I get the darn error message when I try to
reference it in my code.

Any help anyone can offer would me greatly appreciated.

Thanks,
FatMan

Was thi
 
O

OfficeDev18 via AccessMonster.com

Different Access objects have diffrent rules. To access query fields, you can
only use variables set as objects. Ergo,

Dim QRY As QueryDef, VarName As Double

Set QRY=CurrentDb.QueryDefs("qryPackoutPreviousPackoutsSum")
With QRY
VarName = !SumOfBinQty
(or some such)
.....
.Close
End With

Hope This Helps
Hi all:
Can anyone please help me with this.

I need to reefer to a field from a MS Access query (the query has been
created using the query by example grid and not SQL) on a form. The field
name is "BinQty" and shows up as "SumOfBinQty" as the Groupby and sum options
are bing used.

When I reefer to the field in VBA I get the error message "Object Required".
I reefer to the field as:
Queries![qryPackoutPreviousPackoutsSum].[SumOfBinQty]

What is wrong?

The background to this is that I am trying to check to see if the total of
BinQty exceeds the value of BinsIntake. The querry is calculating the
SumOfBinQty correctly but I get the darn error message when I try to
reference it in my code.

Any help anyone can offer would me greatly appreciated.

Thanks,
FatMan

Was thi
 
K

KARL DEWEY

using the query by example grid and not SQL) on a form.
Why not open the form and reference the form in your query like --
[Forms]![YourForm]![YourTextbox]
 

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