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

Need a COUNT from db within code

Status
Not open for further replies.

SCubed

Programmer
Jan 6, 2004
26
US
I need to get the count value back from this sql select statement from my code:

"SELECT count(AssetOwner) " & _
"FROM AssetOwner WHERE AssetOwner = '" & NewAssetOwner.Value & "'"

However, I can't figure out the correct command or syntax to get it. I've tried DoCmd.RunSQL(the above sql statement) and it tells me that "RunSQL requires a SQL statement". I've tried everything I can think of. Please help!

Thank you!
 
Take a look at the Dcount function.

It allows you to get the count over your query or table based upon your criteria.


Steve
 
Hi,

is AssetOwner a field as well as the table name?
Can you post all your code so I can have a look
 
DCOUNT was exactly what I needed!! Thank you, thank you, thank you!!!

SCubed ;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top