Solved

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

Posted on 2009-07-09
4
220 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

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

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Suggested Courses
Course of the Month5 days, 1 hour left to enroll

636 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