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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use data from a table, in a VBA program

Status
Not open for further replies.

halx

Programmer
Jun 5, 2002
35
FR
Hello !

I have a problem with VBA for Access.

Suppose you have a table "tblEmployees" that has two fields: "Name" and "Position".

Does anybody know how to get the position of the employee called "smith" and put it in the VBA variable defined as:
Dim pos As String ?
(the problem is not with SQL, but with storing the answer of the query)

Thanks

Alx
 
Hi alx!

Try this:

pos = DLookUp("Position", "tblEmployees", "Name = 'smith'")

hth
Jeff Bridgham
bridgham@purdue.edu
 
Thanks !

This is really a great forum, I have found a lot of tips for VBA for Access.
I hope I will be able to contribute usefuly, one day.

Bye !

Alex
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top