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

Retrieve a single value 1

Status
Not open for further replies.

besto1a

Programmer
Aug 20, 2006
41
GB
How do i retreive a signle value use a sql statement in VBA I gace tried the following but it dosent work.

Dim myString as string

myString = db.execute "Select Name from Tbl_Users Where UserID = andrew"

 
You can use DlookUp.

[tt]myString = DlookUp("[Name]","Tbl_Users","UserID = 'andrew'")[/tt]

Name is a reserved word and should not be used as a name for anything.

 
Thank My example was a simple one just to illustrate my problem. I need to bring back a count of rows where the name is andrew and assign that value to a integer

 
Use DCount. There are several domain aggregate functions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top