Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enter new date based on record plus combo record

Status
Not open for further replies.

ali32uk

Technical User
Mar 31, 2011
22
GB
Hi All

thought this would be simple, turns out for me its not...

I m trying to do the following

I have a "Startdate" field on a form, and a combo box "comboMonths" and an enddate field, based on the user choosing a date in startdate and then selecting either 3, 6 or 12 from the combo box, I m looking for the enddate to be calculated using startdate+combomonths value

I ve tried this on after combo update function but get errors...

Dim Enddate, Startdate As Date

If Combo49.Value = "3" Then
Enddate = Startdate.AddMonths(3)
ElseIf Combo49.Value = "6" Then
Enddate = Startdate.AddMonths(6)
ElseIf Combo49.Value = "12" Then
Enddate = Startdate.AddMonths(12)
End If

would appreciate if anyone can help!

Ali
 
Hi

EndDate = DateSerial(Year(StartDate), Month(StartDate) + ComboMonths, Day(StartDate))

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Or:
[tt]EndDate = DateAdd("m", ComboMonths, StartDate)
[/tt]

Have fun.

---- Andy

There is a great need for a sarcasm font.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top