Date Add

M

Mike

I have a field in the database that captures the date a client completes an
application.
Thereafter I need to calculate new fields on the form based on the above
date plus x amount of days.
ie. form a is due on date + x amount of days
It is a type of workfloe management, I can then run quries based on due dates.
Please help its driving me crazy trying to do this in excel and I'm a novice
at access
 
W

Wayne-I-M

Sorry just re-read your post

I would not do this in the form. Do it in the query the form is based on.
Use the afterUpdate event of the/a control to requiry the contorl showing the
due date.

In the query add a caluclated column and insert the function there.
Base the Due Date control (on the form) on this calculated column (in the
query)

--
Wayne
Manchester, England.



Wayne-I-M said:
=DateAdd("d", #, [ControlName])

# is the number of days


--
Wayne
Manchester, England.



Mike said:
I have a field in the database that captures the date a client completes an
application.
Thereafter I need to calculate new fields on the form based on the above
date plus x amount of days.
ie. form a is due on date + x amount of days
It is a type of workfloe management, I can then run quries based on due dates.
Please help its driving me crazy trying to do this in excel and I'm a novice
at access
 
M

Mike

Wayne,

Thanks for the reply.
I'm new to access so prefer the first option you mentioned.
i've typed the fromula below in the default value is that correct?
the initial field name is Date Due, but get an error message when i try to
save it saying.............. database engine does not recognise either the
filed 'date Due' in a validation expression, or the default value in the
table 'table 1'
can you advise please?
many thanks

Wayne-I-M said:
=DateAdd("d", #, [ControlName])

# is the number of days


--
Wayne
Manchester, England.



Mike said:
I have a field in the database that captures the date a client completes an
application.
Thereafter I need to calculate new fields on the form based on the above
date plus x amount of days.
ie. form a is due on date + x amount of days
It is a type of workfloe management, I can then run quries based on due dates.
Please help its driving me crazy trying to do this in excel and I'm a novice
at access
 
W

Wayne-I-M

Your is not the best option

Open the query the form is based on.
If you have based it on a table. Create a new query and bring the table
into the design grid. Click * to bring in all the fields.

In a blank column add this

NewDate: DateAdd("d", 10, [TableName]![FieldName] )

Change the TableName to what it is
Change the FieldName to what it is (this you Due Date field I think)

Save the query

Open the form in design view.
Make sure you base it on the query.
If you have not done this already then open the form in design view and
right click and open the properties box. In the Data column (source object
row) slect the new query from the drop down.

Then click view - available fields
Drag the new fieldname (NewDate) in the form somewhere you like it.

Save

Right click on the Due Date control and open the properties box
In the Event Column (AfterUpdate) click the build option (...) and select code

You will see 2 lines already there add this into the middle of these 2

Me.NewDate.requery

Save

Now the NewDate is available to use inother things like reports and other
forms if needed in your application.





--
Wayne
Manchester, England.



Mike said:
Wayne,

Thanks for the reply.
I'm new to access so prefer the first option you mentioned.
i've typed the fromula below in the default value is that correct?
the initial field name is Date Due, but get an error message when i try to
save it saying.............. database engine does not recognise either the
filed 'date Due' in a validation expression, or the default value in the
table 'table 1'
can you advise please?
many thanks

Wayne-I-M said:
=DateAdd("d", #, [ControlName])

# is the number of days


--
Wayne
Manchester, England.



Mike said:
I have a field in the database that captures the date a client completes an
application.
Thereafter I need to calculate new fields on the form based on the above
date plus x amount of days.
ie. form a is due on date + x amount of days
It is a type of workfloe management, I can then run quries based on due dates.
Please help its driving me crazy trying to do this in excel and I'm a novice
at access
 

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