LaRockera02
Registered User.
- Local time
- Today, 08:31
- Joined
- Oct 21, 2011
- Messages
- 83
haha Good!~!~
So what do I do now?
So what do I do now?
DoCmd.OpenReport "SearchCallDat", acViewPreview,, "[ BETWEEN #" & Me.txtBegDate & "# AND #" & Me.txtEndDate & "#"
These three basically mean that when both textboxes are empty you would like it to return all records?We need to be able to do the following:
- Search on any field without dates
- Search on start date
- Search on end date
CORRECTThese three basically mean that when both textboxes are empty you would like it to return all records?
Umm If what you meant is when the end date is empty I want for it show all records beggining with the start date until the last record it can find. and if the start date is empty I want for it to provide me with all the records up to the end date (making sure records on that date are included)When end date textbox is empty you would like it to show records based on start date. And vice versa?
If (Me.txtBegDate__txtStartDate) <> DATE Then
Function Min()
Else
Me.txtBegDate__txtStartDate
End If
If (Me.txtEndDate) <> DATE Then
Function Max()
Else
Me.txtEndDate
End If
Dim dteBeg As Date, dteEnd As Date
If IsDate(Me.txtBegDate) Then
dteBeg = Me.txtBegDate
Else
dteBeg = DMin(...)
End If
If IsDate(Me.txtEndDate) Then
dteEnd = Me.txtEndDate
Else
dteEnd = DMax(...)
End If
DoCmd.OpenReport ........ use dteBeg and dteEnd in the BETWEEN
Dim dteBeg As Date, dteEnd As Date
If IsDate(Me.txtBegDate__txtStartDate) Then
dteBeg = Me.txtBegDate__txtStartDate
Else
dteBeg = DMin("CreatedDate", "qrySearchCalDat", [COLOR=red][][/COLOR])
End If
If IsDate(Me.txtEndDate) Then
dteEnd = Me.txtEndDate
Else
dteEnd = DMax("CreatedDate", "qrySearchCalDat", [COLOR=red][][/COLOR])
End If
DoCmd.OpenReport "SearchCallDat", acViewPreview, , "[CreatedDate] BETWEEN #" & dteBeg & "# AND #" & dteEnd & "#"
Then put the value from above into the criteria.