Thank you! I do have one more question. Sorry! How would I write it in
code? I have a form set up that the user types in two dates (start and end)
and then it will open the query based on those dates. Here is my code:
Dim FName As String
FName = "frm_NCs_Disp_Scp"
Dim WAll As String, WField As String, WMaterial As String, WProcess As
String
WAll = "startdate between #" & _
Me![Start] & "# AND #" & _
Me![End] & "#"
WField = "[NC_DATE_CLS] between #" & _
Me![Start] & "# AND #" & _
Me![End] & "# AND [NC_TYPE] = 'LF'"
WMaterial = "[NC_DATE_CLS] between #" & _
Me![Start] & "# AND #" & _
Me![End] & "# AND [NC_TYPE] = 'LM' OR 'LP'"
WProcess = "[NC_DATE_CLS] between #" & _
Me![Start] & "# AND #" & _
Me![End] & "# AND [NC_TYPE] = 'SF' OR 'SQ' OR 'LR' OR 'LT'"
If Me.optAll.Enabled = True Then
DoCmd.OpenForm FName, , , WAll
ElseIf Me.OptField.Enabled = True Then
DoCmd.OpenForm FName, , , WField
ElseIf Me.OptField.Enabled = True Then
DoCmd.OpenForm FName, , , WMaterial
ElseIf Me.OptField.Enabled = True Then
DoCmd.OpenForm FName, , , WProcess
End If
End Sub
Klatuu said:
The problem is that your field includes time. If you specifiy
< = #1/31/2008#
#1/31/2008# will be looking at
1/31/2008 12:00:00 AM
Any row that has 1/31/2008 will be seen as greater than that. You may try
DateValue([SomeDate]) <= #1/31/2008#
--
Dave Hargis, Microsoft Access MVP
:
Hi, I am trying to get results in a query using the between two dates. (ie
between 1/1/2008 and 1/31/2008) The date is formated in date plus time. (ie
1/31/2008 10:27:16 AM) Everytime I try to get the dates for Jan for some
reason 1/31/2008 will not come up in the results. I have 5 fields that need
to show but are not. In the past I have had not problem but since I got my
new computer I can not get the results. Any help is greatly appreciated. I
have Access 2002.