SQL string problem - pleaze hellp!
- From: plh <plh_member@xxxxxxxxxxx>
- Date: 30 Apr 2005 19:08:39 -0700
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
--
I keep hitting "Esc" -- but I'm still here!
.
- Follow-Ups:
- Re: SQL string problem - pleaze hellp!
- From: Douglas J. Steele
- Re: SQL string problem - pleaze hellp!
- From: Van T. Dinh
- Re: SQL string problem - pleaze hellp!
- From: Ken Snell [MVP]
- Re: SQL string problem - pleaze hellp!
- Prev by Date: Re: Computing time difference
- Next by Date: Re: SQL string problem - pleaze hellp!
- Previous by thread: Re: Computing time difference
- Next by thread: Re: SQL string problem - pleaze hellp!
- Index(es):
Relevant Pages
|