Ray-
You are trying to put a value from your query into a variable, PaymentTotal,
no? From what you've written, I can't tell how you are specifying a
particular record. That is, couldn't there be many PaymentAmount's returned
by your query? Or is the query written in such a way that it will always
only return one record?
You can do the following to lookup a specific field from a specified record
in your query and assign that value to a variable. (It doesn't work if there
are any parameters in your query, however)
PaymentTotal = dlookup("[PaymentAmount]","qryPAYMENTTOTALS","[PaymentYear] =
2005")
The last part is how to tell it to find a certain record. I made up an
example that you have things grouped by year and want the total for 2005.
hope this helps
-John
Ray Todd said:
Is the following possible (where it will correctly execute)? If so, how?
DoCmd.OpenQuery "qryPAYMENTTOTALS"
PaymentTotal = query!qryPAYMENTTOTALS!PaymentAmount
THanks,
Ray.