sql count()

  • Thread starter Thread starter Syrel
  • Start date Start date
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!
 
Simplest approach would be to use the DCount function. Set the ControlSource
property of the text box to

=DCount("*", "Employees")

Include the equal sign.
 
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?
 
DCount("*", "Employees", "Position = 'Associates'")

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

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