Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assign Value to Variable From Table

Status
Not open for further replies.

pd2004

Technical User
Aug 24, 2009
44
US
Hi,

I have what I think is going to be a simple question. I have a value stored in a field in a table with only one record. I want to assign that value to my variable x. Here is what I was trying:

x = Tables![Table1].Field1

I also tried using RunSQL, but was not able to make that work either:

Application.DoCmd.RunSQL "SELECT Table1.Field1" & _
"FROM Table1;"


I know this is really simple. If you could let me know how to do this I would be very grateful.

Thank you,

Pat
 
If there's only one record

x = DLookUp("Field1","Table1")


The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
That is very helpfull. Thank you so much.

Pat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top