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

View the Latest Date?

Status
Not open for further replies.

joelxez

Programmer
Apr 18, 2002
67
PH
Dear Experts,

I have a code below on which supposively view the names of all personnel which has latest date employed. something wrong with my code pls. correct?

set rs = my_conn.Execute ("Select names from tblemployee where Date_employed=DMax()")

Joel,
 
2 questions :
- what is DMax() ?
- what doesn't work ? (do you have an error, no row returned, ...) Water is not bad as long as it stays out human body ;-)
 
Try doing something like this to receive all the employee after a certain date:
Code:
Dim myDate
myDate = "6/1/2002"

set rs = my_conn.Execute ("Select names from tblemployee where Date_employed > '"&myDate&"'")
The above SQL will work for most databases, if your using ms access than you need to surround your date in #s instead of single quotes like so:
Code:
set rs = my_conn.Execute ("Select names from tblemployee where Date_employed > #"&myDate&"#")

An SQL statement is a string like any other string variable before you send it to the database. This means you can concatenate in new values and the results of functions exactly like you would with any other string.

-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
For my next trick I will pull a hat out of a rabbit (if you think thats bad you should see how the pigeon feels...) :p
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top