Updating a date text box from a text box

orshims

Registered User.
Local time
Today, 04:06
Joined
Jan 6, 2010
Messages
41
Hi guys

Ive got a form with a text box that has a date field that the user has to pick a date. I also have a combo box on the same form with different lengths of time in there the user also chooses eg 6 months 1 year 2 years etc.
What I want to happen is the third date field text box To look at the first date filed text box add the period from the combo box and automatically update the third date text box.

I hope this makes since I have been pulling my hair out!!!

Please please help!!

Thanks
 
hi
sorry i tried what you said but i dont understand how i can get this to work for me. my problem is that the user selects a term and this is whats listed in the combo box eg 6 months 1 year 2 years etc i cant get the third box to add the first date to the term and then udate.
sorr for being an idiot!!!

thanks again
 
You need to create a table that has three columns, one for your original text, the second for month (i.e. "m"), and the third for the numerical value. E.g.
Code:
TermID    |    TermType    |    Term
-------------------------
6        m        6 months
Then you use this table as the Row Source of your Combo Box. Then you can use the TermID and the TermType in the DateAdd() function like this:
Code:
Dateadd([TermType], [TermID], [Your Date Value])
So these fields will be columns in your combo box, and you need to refer to the right field in the DateAdd() function.

Makes sense?
 
hi again

ive been trying to do waht you said in the privious message however i have been having the following error message


Private Sub Date_Of_Next_Calibration_AfterUpdate()
dateadd ([termid], [termtype], [Date_of_last_calibration])

End Sub


i have placed the date add function in the box that i want the calculated date into is this correct.
i have created a table like you said for the combo box and made that my source.

sorry in advance if its something im doing!!

thanks again
 
Per the link VbaInet provided you, the syntax for the DateAdd function is:

=DateAdd ( interval, number, date )

You have: dateadd ([termid], [termtype], [Date_of_last_calibration])

Check the field order.

It should be:

=DateAdd([TermType], [TermId], [Date_of_last_calibration])

This should fix it.
 

Users who are viewing this thread

Back
Top Bottom