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
254 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 69

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now