'Next week' filter button?

Toby Honest

New member
Local time
Today, 08:17
Joined
Dec 20, 2010
Messages
6
Access 2010/ web database: The main form is named Task Week Form, and the sub form is named Task Week Subform. The form query is just a basic select query from the the Tasks table, which amongst others contains a StartDate field for each task.

How can I program a button to filter the subform, displaying only the tasks with StartDate during next week from Date? I was about to suggest an On click data macro like this:

Code:
SetLocalVar
Name: nextweek
Expression: NextWeekButton
 
SetFilter
Where Condition=  [StartDate]=[LocalVars]![nextweek] > Date() +7
Control Name: Task Week Subform

Clicking the button results in a blank subform. Is the macro close or far from it? (no vba code allowed in this web application)
 
You don't use a data macro for filtering on a form. You use a regular macro and do it there. And it isn't set value you want you want to APPLY FILTER.
 
Hi boblarson, and thanks for answering :)

I would like to use a normal macro for this, but since this is a web database I believe I'm excluded from that possibility. My understanding is that I have to use the data macros, and choose between the following filter actions in the macro builder:

- RefreshRecord
- Requery
- SetFilter
- SetOrderBy

The restrictions in the web application makes it challenging for an Access rookie like me, since almost every reference on the internet is written in VBA code, and is not applicable in the web app...

Is it impossible to program my button the way I want it, by use of data macros?
 
Hi boblarson, and thanks for answering :)

I would like to use a normal macro for this, but since this is a web database I believe I'm excluded from that possibility. My understanding is that I have to use the data macros, and choose between the following filter actions in the macro builder:

- RefreshRecord
- Requery
- SetFilter
- SetOrderBy

The restrictions in the web application makes it challenging for an Access rookie like me, since almost every reference on the internet is written in VBA code, and is not applicable in the web app...

Is it impossible to program my button the way I want it, by use of data macros?

You don't need data macros. You CAN use regular macros with a web database. You CAN'T use VBA in web databases but you can use macros. The rendering engine converts those to a form which the browser can use (I think I remember the Access Team saying it converted to Java, but I could be wrong as it was a couple of years ago when I was at Microsoft getting a chance to play with the new 2010 stuff way before it was released).
 
Additional:

Data Macros do manipulations on data. Regular macros are for form and report actions. Got it?
 
No, I don't think I got it, so I just have to ask: how can I write a normal macro when working with a web database in Access 2010?
 
No, I don't think I got it, so I just have to ask: how can I write a normal macro when working with a web database in Access 2010?

I don't have my Access 2010 with me at the moment but I'll flag someone who happens to have more experience than I currently with the web database thing.
 
A clarification on the terminology:

With 2010, there are more flavors of macros that are quite different.

Normal macros are the same macro as we've known them since the first version of Access, albeit with a new interface.
Data macros are macro that are associated with tables and have no UI.
Web macros are similar to normal macros in that they do some UI manipulation but are also web-legal.

So, in OP's case, we're actually using web UI macros, not data macros.

Anyway, I believe this is incorrect:
Code:
SetFilter
Where Condition=  [StartDate]=[LocalVars]![nextweek] > Date() +7

I think it should be:
Code:
Where Condition= [StartDate]>(Date() + 7)
 
Thanks to both B's, for clarifying the macro terminology, and getting me on the right track regarding the macro code. The button is certainly filtering now, but I need to fiddle around with the macro to get it to filter the correct dates :)

Thanks again!
 

Users who are viewing this thread

Back
Top Bottom