Solved

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

Posted on 2009-07-09
4
179 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
Comment Utility
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
Comment Utility
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
Comment Utility
I used DLookUp once for each field I was looking for. It worked
0
 

Author Closing Comment

by:AAlpha1
Comment Utility
Thanks
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now