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

Newbie needs help

Status
Not open for further replies.

greg85374

Programmer
Apr 27, 2003
10
0
0
US
I need to know how to do the following:
I need to know hot to setup table(s) so that I can query an EMPLOYEEID so that Whatever month in my calendar the user is on I can loop through the days in that current month and get a value for that day

eg..I setup a table called "EmpAttendance"
With "EntryID" as my PK
and the 3 fields...
"EmployeeID" -FK
"Date"
"Value"

But when I loop through the dates how do I know what value it will bring up?


eg..If the user is working in July,2004 there will be 31 days.

to loop through the days is easy...
For I = 1 to 31 step 1
txtdate(i).text = resultset
Next i

I tried the code:
SqlString = "SELECT Date From TblEmpAttendance WHERE Value In ('1','2','3','7','w') And TblEmployee.EmployeeID=TblEmpAttendance.EmployeeID AS resultset;"

which my vb tells me is bad sql syntax
If my table is set up correctly I just need the sqlcode
if not i need to know how to set up my table AND the sql code...

Any help would be highly appreciated!
Thanks!!!
 
First, avoid to use reserved words like Date and Value as field name: lot of headaches in perspective.
I don't quite well understand your sqlString as it is far from a valid SELECT statement.
Try to use the Query Design Window and then you have some working example, take a look at the generated SQL.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Greg

Aside from the day of the month, what are you trying to do?

By the way, look up the DAY, DATE and WEEK functions...

The DAY function returns the day-of-month.

Syntax...

DAY(#YourDate#)

For example...

DAY(DATE()) returns 21
as does
DAY(NOW())

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top