Solved

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

Posted on 2009-07-09
4
189 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

Suggested Solutions

Title # Comments Views Activity
ms sql stored procedure 22 87
Modifying Conditional Format from VBA code 3 48
Fixed Length SQL Query Question 3 28
MS SQL - Rotating Values in SQL 9 47
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
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 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…

919 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

20 Experts available now in Live!

Get 1:1 Help Now