querying a query

G

Guest

Basicly the query below tells me all empolyees scheduled to work on
11/01/2004. What I want to know is if any of those employees StartTime or
EndTime falls between and other employees StartTime and EndTime. If it does
then I need to change a color of a textbox to yellow.

Thanks for any help you may have.

Sub testing()
Dim db As Database, strSQL As String
Dim qdf As QueryDef, rst As Recordset

strSQL = "SELECT Main.Employees, Format(Main.C_StartTimes, 'h:nn A/P') AS
StartTime, " _
& "Format(Main.C_EndTimes,'h:nn A/P') AS EndTime, Main.Date,
Main.Clients " _
& "FROM Main WHERE (((Main.Date)=#11/01/2004#) AND
((Main.Clients)= 'Barbara C'))" _
& "ORDER BY Main.C_StartTimes;"

Set db = CurrentDb()
Set qdf = db.CreateQueryDef("", strSQL)
Set rst = qdf.OpenRecordset



End Sub
 
J

JohnFol

You need to do this within the form/report containing the text box, probably
on the OnCurrent / Onformat events. To look up the start / end times of
other employees, have a look at the dcount / dlookup functions, or consider
a recordsetclone.
 

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

Similar Threads


Top