Solved

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

Posted on 2004-04-28
8
256 Views
Last Modified: 2010-05-02
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
0
Comment
Question by:Lukasx
8 Comments
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 10939625
You also have to specify on which field to filter!

rs.filter = "YourField = '" + Defdate + "'"
0
 
LVL 1

Expert Comment

by:iclemartin
ID: 10943975
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.
0
 

Author Comment

by:Lukasx
ID: 10958053
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!

0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 1

Expert Comment

by:iclemartin
ID: 10961114
0
 

Author Comment

by:Lukasx
ID: 11004247
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.
0
 

Author Comment

by:Lukasx
ID: 11153006
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
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 11186725
Closed, 500 points refunded.

modulo
Community Support Moderator
Experts Exchange
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question