PC Review


Reply
Thread Tools Rate Thread

Data Access Page - filter for date range

 
 
New Member
Join Date: Jul 2008
Posts: 1
 
      4th Sep 2008
Hi everybody,

I've created a data access page that prompts the user for a set of dates that are to be used as search parameters for another data access page. The 'Search' page is set up and works beautifully. It accepts the dates as cookies and, from all indications passes them without issue.

My other dap, the 'Results' page isn't playing well with others, though. It's based on a query (qryCalls) and needs to filter out the dates based on the parameters.

I'm not an expert with data access pages, but I'm pretty proficient...at least I thought I was until I tried to pass data back and forth between two daps. Please help, if you can!

Here's the code that I've put together for both pages so far. The last line of the Results page was my last attempt. I also tried an 'rs.Find' method with little success, but that could just be my inexperience.

Search page --
Code:
dim pStartingDate 
dim pEndingDate 
dim rs 
dim strCookie 
dim intLoc 
dim StartingDate 
*
if len(StartDate.value) = 0 then 
msgbox "You must enter a value for the starting date", vbexclamation, "Date error" 
StartDate.focus() 
exit sub 
end if 
*
if len(EndDate.value) = 0 then 
msgbox "You must enter a value for the ending date", vbexclamation, "Date error" 
EndDate.focus() 
exit sub 
end if 
*
if datediff("d", Date(), StartDate.value) > 0 then 
msgbox "Start date cannot be a future date", vbexclamation, "Date error" 
StartDate.value = "" 
StartDate.focus() 
exit sub 
end if 
*
if datediff("d", Date(), EndDate.value) > 0 then 
msgbox "End date cannot be a future date", vbexclamation, "Date error" 
EndDate.value = "" 
EndDate.focus() 
exit sub 
end if 
*
if datediff("d", EndDate.value, StartDate.value) > 0 then 
msgbox "End date must have occurred after the Start date", vbexclamation, "Date error" 
StartDate.value = "" 
EndDate.value = "" 
StartDate.focus() 
exit sub 
end if 
*
pStartingDate = StartDate.value 
pEndingDate = EndDate.value 
*
document.cookie = "StartDate=" & pStartingDate 
document.cookie = "EndDate=" & pEndingDate 
*
'msgbox "The cookie holds the following value: " & document.cookie 
*
window.open "Results.htm","_self"
*
Results page --
Code:
dim strCookie 
dim intLoc 
dim StartingDate 
dim EndingDate 
*
strCookie = document.cookie 
intLoc = instr(strCookie,"StartDate=") 
*
if intLoc > 0 then 
StartingDate = mid(strCookie, intLoc + 10) 
intLoc = instr(StartingDate, ";") 
if intLoc > 0 then 
StartingDate = Left(StartingDate, intLoc-1) 
end if 
end if 
*
'msgbox "Starting date = " & StartingDate,,"Start Date" 
*
strCookie = document.cookie 
intLoc = instr(strCookie,"EndDate=") 
*
if intLoc > 0 then 
EndingDate = mid(strCookie, intLoc + 8) 
intLoc = instr(EndingDate, ";") 
if intLoc > 0 then 
EndingDate = Left(EndingDate, intLoc-1) 
end if 
end if 
*
'msgbox "Ending date = " & EndingDate,,"End Date" 
*
'MSODSC.RecordsetDefs("qryCRS_Data_Log")..ServerFilter = "DateField > " & StartingDate & "DateField < " & EndingDate
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access Data Page filter option Jason Lopez Microsoft Access 3 5th Oct 2007 02:51 PM
Access Data Page filter option Jason Lopez Microsoft Access Forms 3 5th Oct 2007 02:51 PM
dropdown filter on Data Access Page =?Utf-8?B?Q2hyaXM=?= Microsoft Access 1 20th Aug 2007 07:36 PM
Data Access Page Filter =?Utf-8?B?UGVubmVy?= Microsoft Access 1 27th Mar 2005 02:31 PM
how to filter information in a data access page Kendra Microsoft Access 0 19th Feb 2004 06:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:51 PM.