I am trying to pull out only records that have birthdays between such and such dates. I must be writing the expression all wrong. In the quiery under the Birthday field,under criteria I write: Between [7/01/2004] and [7/30/2004]
When I run the query, not a single record appears!
I had a similar situation and went about it a bit differently. I created an UnboundForm and placed to TextBoxes on it. One for BeginningDate and one EndingDate. Then, once both dates are entered I have a CommandButton that does all the work. Simply called OpenForm. The code behind it is this:
Private Sub cmdOpenForm_Click()
On Error GoTo Err_cmdOpenForm_Click
'This will pull every date between these dates, inclusive. Give it a whirl Julie.
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmDateGrabber"
stLinkCriteria = "[PurchaseDate]>=" & "#" & Me![BeginningDate] & "# AND [PurchaseDate]<=" & "#" & Me![EndingDate] & "#"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Also for the sake of making it easy to clear your entries if you change your mind I have this code behind the RESET button:
Private Sub Reset_Click()
If Not IsNull(BeginningDate) And Not IsNull(EndingDate) Then
[BeginningDate] = ""
[EndingDate] = ""
That's all there is to it. Let me know if you like it. This way you don't have to set parameters in your query and the fields for both dates are also Formatted. This way the user just types and the format (input mask) is automatic.