Link to home
Start Free TrialLog in
Avatar of AAlpha1
AAlpha1

asked on

How to run a SQL query code and store the results without opening a query?

Given:
A table: tPricing
A query: Select (DeliveryID, PricePeriodID) from tPricing Where (tPricing!DeliveryID = Forms!fPricing!DeliveryID AND tPricing!PricePeriodID = Forms!fPricing!PricePeriodID)

I then want to save the query results (only 2 fields in one record are possible) in Variables that I can validate (e.g. Null). I do not want to save the same information twice!

Is it doable? How, please?
ASKER CERTIFIED SOLUTION
Avatar of 8080_Diver
8080_Diver
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AAlpha1
AAlpha1

ASKER

So what would be the syntax?

StrSQL = Select( ........)
DoCmd.RunSQL (strSQL)    I expect Two fields from this. Say Field1 and Field2

Var1 = Field1
Var2 = Field2

Will that do it?
Avatar of AAlpha1

ASKER

I used DLookUp once for each field I was looking for. It worked
Avatar of AAlpha1

ASKER

Thanks