Solved

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

Posted on 2009-07-09
4
202 Views
Last Modified: 2013-12-25
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?
0
Comment
Question by:AAlpha1
  • 3
4 Comments
 
LVL 22

Accepted Solution

by:
8080_Diver earned 500 total points
ID: 24819417
It is doable in VBA by opening the query and accessing the column and storing them in variables . . . assuming that is what you are trying to do.
I do not want to save the same information twice!
 I am not exactly sure what you mean by that part of the question, though.
0
 

Author Comment

by:AAlpha1
ID: 24819575
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?
0
 

Author Comment

by:AAlpha1
ID: 24835953
I used DLookUp once for each field I was looking for. It worked
0
 

Author Closing Comment

by:AAlpha1
ID: 31601827
Thanks
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question