Tough Query Problem

  • Thread starter Thread starter SRude
  • Start date Start date
S

SRude

I have a temporary table, tblQualifications, and it
includes 7 Yes/No fields (RDOsat, RDOsun...) representing
the days of the week. There is a form where the Foreman
can see the entire roster and select the person's regular
days off.

There is a form with a calendar. I need a query that
will delete the person's record from tblQualifications if
the checkbox (RDOsat for example) is selected indicating
that the person has the day off is the same as the day
selected in the calendar ([Forms]![frmDeptShiftSELECT]!
[CalValue])

I had this working when I had one field (RDO) but decided
to use seven fields so that the foremen had an easier
form to work with. The form does work great but I can't
get this query to work so I may have to go back.

As always I really appreciate your generous help.
 
I thought something like this would work but I get an
error! The error is "Compile Error Sub or Function not
defined"

Private Sub TEST_Click()
Dim intRDO As Integer
intRDO = DatePart("w", [Forms]![frmDeptShiftSELECT]!
[CalValue])

Select Case intRDO

Case 1
Delete tblQualifications.[Empl Nbr]
FROM tblQualifications
WHERE (((tblQualifications.RDOsun) = -1))

Case 2
Delete tblQualifications.[Empl Nbr]
FROM tblQualifications
WHERE (((tblQualifications.RDOmon) = -1))

Case 3
Delete tblQualifications.[Empl Nbr]
FROM tblQualifications
WHERE (((tblQualifications.RDOtue) = -1))

Case 4
Delete tblQualifications.[Empl Nbr]
FROM tblQualifications
WHERE (((tblQualifications.RDOwed) = -1))

Case 5
Delete tblQualifications.[Empl Nbr]
FROM tblQualifications
WHERE (((tblQualifications.RDOthu) = -1))

Case 6
Delete tblQualifications.[Empl Nbr]
FROM tblQualifications
WHERE (((tblQualifications.RDOfri) = -1))

Case 7
Delete tblQualifications.[Empl Nbr]
FROM tblQualifications
WHERE (((tblQualifications.RDOsat) = -1))

End Select
End Sub
 
I thought something like this would work but I get an
error! The error is "Compile Error Sub or Function not
defined"

Private Sub TEST_Click()
Dim intRDO As Integer
intRDO = DatePart("w", [Forms]![frmDeptShiftSELECT]!
[CalValue])

<Snip>

What's "DatePart" is it a variable that you've defined yourself, a function
you've defined yourself or is it a function in Access? I ask because I
haven't seen this one before and if it's a variable that you're using you
don't appear to have declared it in this part of the code.

I may be on completely the wrong track though, I'm fairly new to all of this
myself.

Raist.
 
DatePart is a function in Access. You can have it look
at a date and return the year, month, day, ...
 
Back
Top