More gripes with Access 2007

S

Stapes

Hi

I have a routine in that runs when my menu loads that checks if there
are any orders due for delivery today. It invites the user to process
them now. If yes, it opens the Order form to display these records,
using a global variable to tell the order form to filter for Orders
due for delivery today.

This is performed by the following bit of code:

If global_orders_due_today = True Then
Me.TxtCurrentView = "DELIVERY DUE"
global_orders_due_today = False
Call disable_buttons
Me.Filter = "([DeliverOnDate]<=#" & formatted_date &
"#) and ([DeliveryNote]=False)"
Me.FilterOn = True
Me.DataEntry = False
Me.AllowAdditions = False
DoCmd.ApplyFilter , "([DeliverOnDate]=#" &
formatted_date & "#) and ([DeliveryNote]=False)"

It does not work in Access 2007 - it displays all the records.

How can I get it working?

Stapes
 
M

MPM1100

Hi Stapes,

Try this... First, eliminate your global variable and all related code for
this action.

Create an procedure for the form's Open event.
Create a desired query with the necessary criteria, then set the form's
recordsource to that query.

The key reason for operating this way is that you don't want the form to
query for all records every time it is opened. That may eventually become
slow and cumbersome. Filters don't reduce the number of records retreived
from the database. Filters are best used when you have retrieved a desired
recordset and you want to refine your results.
 
S

Stapes

Hi Stapes,

Try this... First, eliminate your global variable and all related code for
this action.

Create an procedure for the form's Open event.  
Create a desired query with the necessary criteria, then set the form's
recordsource to that query.  

The key reason for operating this way is that you don't want the form to
query for all records every time it is opened.  That may eventually become
slow and cumbersome.  Filters don't reduce the number of records retreived
from the database.  Filters are best used when you have retrieved a desired
recordset and you want to refine your results.



Stapes said:
I have a routine in that runs when my menu loads that checks if there
are any orders due for delivery today. It invites the user to process
them now. If yes, it opens the Order form to display these records,
using a global variable to tell the order form to filter for Orders
due for delivery today.
This is performed by the following bit of code:
If global_orders_due_today = True Then
                Me.TxtCurrentView = "DELIVERY DUE"
                global_orders_due_today = False
                Call disable_buttons
                Me.Filter = "([DeliverOnDate]<=#" & formatted_date &
"#) and ([DeliveryNote]=False)"
                Me.FilterOn = True
                Me.DataEntry = False
                Me.AllowAdditions = False
                DoCmd.ApplyFilter , "([DeliverOnDate]=#" &
formatted_date & "#) and ([DeliveryNote]=False)"
It does not work in Access 2007 - it displays all the records.
How can I get it working?
Stapes- Hide quoted text -

- Show quoted text -

No - that is no good. My Order Form has many entry points, being
called from many places in the system, and has to do different things
depending on where it is called from.
I am not concerned about the number of records retrieved from the
database.
I just want it to work the way it already does in Avccess 2007.

Stapes
 
A

aaron.kempf

yah I've used variables like that a LOT.. I generally store the
results in the database also... so that if I want to use the variables
in SQL; then I just use a subquery; etc.

I just use property set, get and let to do this

-Aaron

Hi Stapes,
Try this... First, eliminate your global variable and all related code for
this action.
Create an procedure for the form's Open event.  
Create a desired query with the necessary criteria, then set the form's
recordsource to that query.  
The key reason for operating this way is that you don't want the form to
query for all records every time it is opened.  That may eventually become
slow and cumbersome.  Filters don't reduce the number of records retreived
from the database.  Filters are best used when you have retrieved a desired
recordset and you want to refine your results.
Stapes said:
Hi
I have a routine in that runs when my menu loads that checks if there
are any orders due for delivery today. It invites the user to process
them now. If yes, it opens the Order form to display these records,
using a global variable to tell the order form to filter for Orders
due for delivery today.
This is performed by the following bit of code:
If global_orders_due_today = True Then
                Me.TxtCurrentView = "DELIVERY DUE"
                global_orders_due_today = False
                Call disable_buttons
                Me.Filter = "([DeliverOnDate]<=#" & formatted_date &
"#) and ([DeliveryNote]=False)"
                Me.FilterOn = True
                Me.DataEntry = False
                Me.AllowAdditions = False
                DoCmd.ApplyFilter , "([DeliverOnDate]=#" &
formatted_date & "#) and ([DeliveryNote]=False)"
It does not work in Access 2007 - it displays all the records.
How can I get it working?
Stapes- Hide quoted text -
- Show quoted text -

No - that is no good. My Order Form has many entry points, being
called from many places in the system, and has to do different things
depending on where it is called from.
I am not concerned about the number of records retrieved from the
database.
I just want it to work the way it already does in Avccess 2007.

Stapes- Hide quoted text -

- Show quoted text -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top