Link to home
Start Free TrialLog in
Avatar of Lukasx
Lukasx

asked on

Is the rs.filter property exclusively for ASP use, or can I also using in a standard Data Access Page using VBscript?

Hi folks,

I have an MS Access Data Access Page displaying a report.  I wish to change the criteria of the report query by using the rs.filter property in conjunction with a combo box.  I just need to check with you guys that this particular property will work with VBscript as opposed to ASP (I currently suspect this is exclusively an ASP property).  If anyone can point me in the direction of more info on this rs.filter property, I'd be grateful!!

Here is the code I'm trying to apply it to:

<SCRIPT language=VBSCRIPT event=onload>
function DefaultDate()
{
Dim DefDate as variant

DefDate = format(dateadd("m",-4,now()), "YYYY/MM")

rs.filter = Defdate
 
}
</SCRIPT>

If the code is flawed, please mention it and I'll set up another question specifically for a functional alternative.  At this time, I'd be grateful just to know if the rs.filter property can work in a Data Access Page type webpage (VBscript is generally supposed to work with them).

Cheers,

Luke
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

You also have to specify on which field to filter!

rs.filter = "YourField = '" + Defdate + "'"
Avatar of iclemartin
iclemartin

Looks like you are confusing the clientside script execution with the serverside script execution.

I suspect that the variable rs is declared in your ASP page inside the <% %> delimiters. This indicates that the code only exists when the server is executing your page.

Your script with the onLoad event is executing within the browser (the clientside).

Your need to get the date parameter back to the server so you can apply it to the RecordSet.
Avatar of Lukasx

ASKER

Thanks for your response on this!

So, must I apply the filter serverside?

Our system doesn't support ASP, and I have been trying to milk what I can from Access's Data Access Pages.  At this point, I have created a query which displays ALL my records, and I'd like to filter it down to months.  The Group Level Filter component of Access can do what I'm after on a very basic rigid level.  I assumed that I might be able to accomplish the same thing using code, more specifically VBscript.

I'm probably getting very mixed up about which languages, etc I'm using!

Avatar of Lukasx

ASKER

Believe it or not, the Group Level Filter was the first (and my current) method of accomplishing this task.  Unfortunately, my client requires more flexibility, i.e. being able to set up a default query filter, as opposed to the page loading up with no records (which is what the Group Level Filter does).

I'm looking for a code alternative to the built-in Group Level Filter function of Access.  Unfortunately, due to limitations of our intranet servers, Server-based languages and options, e.g. ASP are not an option.  I was hoping that it might be possible to query the database using SQL with VBscript.
Avatar of Lukasx

ASKER

Just to let you guys know, I've found a solution to my problem here.

I didn't pursue a Data Access Page solution, but instead created a simple HTML page, added an ADO connection to the database, and used VBScript to add interactivity.

I can heartily recommend this method as it provides a lot of flexibility in the coding that I could not manage with the Data Access Page.

Thanks for your efforts guys, but I think I should just close this post down now.

Cheers,

Luke
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial