Update dates and keep a history (1 Viewer)

Tom A

New member
Local time
Today, 09:15
Joined
May 4, 2020
Messages
6
Hello everyone,
I am working for a big project in Microsoft Access and I am stuck and I would like your help in or your ideas.
I must create an app with a list of works that we have to do each day (for example we have to change oils to a machine each 4 days) and I would like a programme in visual basic that each time someone validate a task from that list (from a checkbox) to do 2 things:
1. Save that information from that row in a table (like a history).
2. To update the previous date of lubrification in the future date (for example 04/05/2020 to 08/05/2020).
Thanks in advance for your help
Tom
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:15
Joined
Oct 29, 2018
Messages
21,358
Hi Tom. Welcome to AWF!

#1 is okay. You can store all tasks performed in a table, so you can have a history. But, #2 is not needed. You can simply use a query to project the next due date based on the last record in history.
 

Tom A

New member
Local time
Today, 09:15
Joined
May 4, 2020
Messages
6
Hi theDBguy,
Could you explaine me how can I project the next due date in a work ? What must I do ?
PS: thank you very much for your response.
Tom
 

theDBguy

I’m here to help
Staff member
Local time
Today, 01:15
Joined
Oct 29, 2018
Messages
21,358
Hi theDBguy,
Could you explaine me how can I project the next due date in a work ? What must I do ?
PS: thank you very much for your response.
Tom
Hi Tom. In a query, you can create a calculated column using the DateAdd() function.
 

bob fitz

AWF VIP
Local time
Today, 08:15
Joined
May 23, 2011
Messages
4,717
Use DateAdd() function. See: https://support.microsoft.com/en-us...357-9424-61e8c57afc19?ui=en-us&rs=en-us&ad=us

The following expressions add four days.

In a query you would create a calculated field with something like:
NextDate : DateAdd("d",4,"[LastDate]")
On a form which is using the query as its Record Source bind a text box to the calculated field "NextDate".

Or you could use the calculation as the Record Source of an unbound text box with:
=DateAdd("d",4,"[LastDate]")
 

Tom A

New member
Local time
Today, 09:15
Joined
May 4, 2020
Messages
6
The problem is that we have many machines and in each machine we have a field with differents frequences (for examples 4 days, 30 days etc) so the function dosent work for me.
 

bob fitz

AWF VIP
Local time
Today, 08:15
Joined
May 23, 2011
Messages
4,717
Try:

NextDate : ("d",[YourFieldName],"[LastDate]")
or
= ("d",[YourFieldName],"[LastDate]")

Replace [YourFieldName] with the name of your field that has the number of days.
 

Tom A

New member
Local time
Today, 09:15
Joined
May 4, 2020
Messages
6
It dosent work, it gives me an error of syntax.
 
Last edited:

bob fitz

AWF VIP
Local time
Today, 08:15
Joined
May 23, 2011
Messages
4,717
Never mind, I found want it wanted. It's working thank you.
I'm glad you've go it working :)
Perhaps, for the benefit of other members, you could share your solution.
 

Users who are viewing this thread

Top Bottom