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
253 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
Comment Utility
You also have to specify on which field to filter!

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

Expert Comment

by:iclemartin
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Expert Comment

by:iclemartin
Comment Utility
0
 

Author Comment

by:Lukasx
Comment Utility
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
Comment Utility
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
Comment Utility
Closed, 500 points refunded.

modulo
Community Support Moderator
Experts Exchange
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
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…

771 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

14 Experts available now in Live!

Get 1:1 Help Now