P
plh
The following actually creates a query but with nothing in it, even in cases
where I am sure there are patients with "DDate" in the moth specified by my
attempted restriction. That is strSQL ends up as:
SELECT * FROM tblPatients WHERE DDate >= 4/1/2005 AND DDate <= 4/30/2005;
It's Access97. Any help would be greatly appreciated!
-Paul H.
Select Case Me.cbxMonth.Value
Case 1, 3, 5, 7, 8, 10, 12
intLastDay = 31
Case 4, 6, 9, 11
intLastDay = 30
Case 2
If Me.txtYear.Value Mod 4 <> 0 Then
intLastDay = 28
ElseIf Me.txtYear.Value Mod 400 = 0 Then
intLastDay = 29
ElseIf Me.txtYear.Value Mod 100 = 0 Then
intLastDay = 28
End If
End Select
strSQL = "SELECT * FROM tblPatients WHERE DDate >= " & Me.cbxMonth.Value & "/1/"
& Me.txtYear.Value & _
" AND DDate <= " & Me.cbxMonth.Value & "/" & intLastDay & "/" & Me.txtYear.Value
& ";"
Set db = CurrentDb
With db
Set qdf = .CreateQueryDef("qryTest", strSQL)
End With
where I am sure there are patients with "DDate" in the moth specified by my
attempted restriction. That is strSQL ends up as:
SELECT * FROM tblPatients WHERE DDate >= 4/1/2005 AND DDate <= 4/30/2005;
It's Access97. Any help would be greatly appreciated!
-Paul H.
Select Case Me.cbxMonth.Value
Case 1, 3, 5, 7, 8, 10, 12
intLastDay = 31
Case 4, 6, 9, 11
intLastDay = 30
Case 2
If Me.txtYear.Value Mod 4 <> 0 Then
intLastDay = 28
ElseIf Me.txtYear.Value Mod 400 = 0 Then
intLastDay = 29
ElseIf Me.txtYear.Value Mod 100 = 0 Then
intLastDay = 28
End If
End Select
strSQL = "SELECT * FROM tblPatients WHERE DDate >= " & Me.cbxMonth.Value & "/1/"
& Me.txtYear.Value & _
" AND DDate <= " & Me.cbxMonth.Value & "/" & intLastDay & "/" & Me.txtYear.Value
& ";"
Set db = CurrentDb
With db
Set qdf = .CreateQueryDef("qryTest", strSQL)
End With