By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,825 Members | 2,437 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,825 IT Pros & Developers. It's quick & easy.

storing access query result in variable

P: 30

i have a table..

in that there are three columns "motor id" "voltage" and "current"

i want to select voltage of motor whose id is 10
so query will be

select voltage from table1 where id = 10

my question is how to store output of this query to any variable ??
so that i can apply formulas on result.

please help me i am not able to write code
Aug 6 '12 #1
Share this Question
Share on Google+
3 Replies

P: 50
Hi Prasad

define your Variable
Open a recordset based on your query
assign the value of voltage to your variable
close and destroy the recordset
Aug 6 '12 #2

P: 30
please tell me code i am using access 2007
Aug 8 '12 #3

Expert Mod 5K+
P: 5,397
prasad joshi

Most of us are not going to provide a coded solution until you've posted your efforts. I'm sure that you'll understand why once you've read thru:
It is all too easy to have students ask questions and get the answers to their homework.

John gave you a very good outline for solving this using a record set. This would be a good method if the database is large.

However, for smaller databases, and simple code, returning only one or two lookup-ed values I would suggest the DLOOKUP method.
Yes... it's for 2000 however the syntax didn't change.

Please take a hand at writing the code...
Once you have it... post it here to let us know if you've succeded or you need more help.

Aug 8 '12 #4

Post your reply

Sign in to post your reply or Sign up for a free account.