Easy select query question

K

Kate

Hi,
I have a form in which the user selects various properties from drop
down lists.
The idea is that based on the properties selected, a different cost is
associated with that part.

I have a select query that runs on a command button, and it basically
filters for all those properties. This part works fine - I have a
query with just one record in it - I want to use one of the fields in
this select query and set a field on the main form equal to it.

I don't see why I can't just go:
Forms!FormName!Cost= Queries!QueryName!Cost
but I get the error "Object Required"

I'm pretty sure this must be something easy I'm doing wrong...

Cheers
Kate
 
B

boblarson

You can't reference queries that way. But you can use a Dlookup, or perhaps
even include the cost in your combo's rowsource so that you can just refer to
the column.

To do the DLookup, you would do something like (if the query returns only
one record):

Forms!FormName!Cost= DLookup("Cost", "YourQueryNameHere")

Replace YourQueryNameHere with the actual query name.

--
Bob Larson
Access MVP
Access World Forums Administrator
Utter Access VIP

Tutorials at http://www.btabdevelopment.com

__________________________________
 

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