Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to filter form with date range. 1

Status
Not open for further replies.

nmapeso

Technical User
Aug 26, 2005
28
0
0
US
I have this code and getting syntax error; Not sure what syntax for this.
Not sure whats the proper syntax for stLinkCriteria to filter form on date range.


On Error GoTo Err_Open_Click
If Dcount("*", "QryDateRecieved") = 0 Then
MsgBox "There are no records to display"
Me!EnterDate.SetFocus
Else
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "maintblBankruptcy"
[Forms]![maintblBankruptcy]!cmdfilter.Visible = True
Me.Visible = False
stLinkCriteria = Between("[DateRecieved]=" & "#" & Format$(Me![EnterDate], "yyyy-mm-dd") & "#" & "[DateRecieved]=" & "#" & Format$(Me![EndDate2], "yyyy-mm-dd") & "#")
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close , "frmQueryrecieved"
End If
Exit_Open_Click:
Exit Sub

Err_Open_Click:
MsgBox Err.Description
Resume Exit_Open_Click

End Sub
 
stLinkCriteria = "DateRecieved Between #" & Format(Me!EnterDate, "yyyy-mm-dd") & "# And #" & Format(Me!EndDate2, "yyyy-mm-dd") & "#"


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top