RE: automatically change expiration date's fields record after one

Tech-Archive recommends: Fix windows errors by optimizing your registry



I don't know where you are applying the filter for the report. It can be
either in the query that is the report's recordset or in can be in the report
itself. The best way to do what you want is to create a from where you enter
the dates, then use the form to run both the update query and the report.
Both queries (I am assuming you are filtering the report in the query) should
then reference the form to get the dates. So the criteria for each date
shoud reference the form something line:
[Forms]![YourFormName]![FormControlName]

"SCB" wrote:

Thanks a lot, everuthing is working.
I just had one more question, I hope you can help me again.

I have made the update to query. I can also filter the dates I want it to
change.
I have made a macro to run the update query-change the expiration date by
adding one year-and to open a report to show the expiration dates.
Problem is the to report that opens I have also a filter for the exp.
dates,and it asks me to enter the filter criteria.
I wanted it to open the report with the dates that I have already filtered
when running the update to query.
Is this possible?

I hope to have explained myself, it's difficult.

I hope you can help me.

Thanks again!

"Klatuu" wrote:

Yes it can. You would include the fields you want to filter on and put the
filtering criteria in the Criteria: row. Leave the Update To: row blank so
it will not change those fields.

"SCB" wrote:

It works!
But now I've noticed. It will change all records. Can it only changes the
records I filter?

"Klatuu" wrote:

Create a query using the query builder. Unless there is some filtering
required, you only need to include in the query the date field you want to
change. Select Update as the query type. In the row of the query builder
that says Update To: enter the code I posted previously. When you run the
query, all records will be updated with the new value.

"SCB" wrote:

Can you please explain how to do this, this is somewhat new for me. I
couldn't figure out how to do it.

Please help again. and THANKS for the reply

"Klatuu" wrote:

First, Date() = 365 will work until you hit a leap year, then it will loose a
day. You should always use date math functions when working with dates. For
example. If you use 5/1/1999 as you date, then your math will return
4/30/2000. Using the corrrect function, it will return 5/1/2000 as it should.

DateAdd("yyyy", 1, date)

Now, to change the dates, you will need an update query that will use the
above function in the Update To of the query builder.

"SCB" wrote:

I have an "expiry date" field that has a default value of: Date()+365, so it
calculates the expiry date automatically. Now I also want this date to change
every year automatically.
Please help...
.



Relevant Pages

  • Re: Use wildcard in combo box with multiple strings
    ... Add the field to the query then. ... filter by it, it has to be in the query... ... use the field to filter what rows are in the RecordSource for the report. ... The string you use as a filter must repeat the name of the field for ...
    (microsoft.public.access.forms)
  • Re: Need help applying SQL statement to Access2000 Query
    ... >WHERE clause, but with an ORDER BY clause. ... >construct the filter string and then open the main form (or report). ... to build the query and open the Main Form or a report ...
    (microsoft.public.access.formscoding)
  • Re: filtering reports
    ... Does this relate to the idea of the Filter or assigning the ... >I put in the code for the query supplied report ... >>If you need to combine two conditions, mock up a query ... > SQL View (View ...
    (microsoft.public.access.formscoding)
  • Re: Count Unique Values with sorting and filtering by pop-up form
    ... here is a sample of code I use to apply filter ... query criteria will be valid only when the report is loaded. ... > MS Access MVP ...
    (microsoft.public.access.reports)
  • Re: Report from a filtered form?
    ... is actually a lookup table (not lookup field). ... > problem filter active. ... > query of the report. ...
    (microsoft.public.access.reports)