sql count()

S

Syrel

need help guys.

how can i display an sql count to my textbox.

example:
select count(name) from employees.

i need to display the total number of emplyees to my textbox.

thank you!
 
D

Douglas J. Steele

Simplest approach would be to use the DCount function. Set the ControlSource
property of the text box to

=DCount("*", "Employees")

Include the equal sign.
 
S

Syrel

oh.. thank you.. i have a follow up question, what if i have a parameters.

example:
select count(name) from employees where position = "associates"

how can i apply this to dcount function?
 
D

Douglas J. Steele

DCount("*", "Employees", "Position = 'Associates'")

Note that I've put single quotes around the value. Exagerated for clarity,
it's

DCount("*", "Employees", "Position = ' Associates ' " )
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top