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
255 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

803 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