DateAdd Syntax

Ice Rhino

Registered User.
Local time
Today, 11:30
Joined
Jun 30, 2000
Messages
210
Hi

I have a combo box on my form. I wish to set the value of a text box on lost focus of the combo to be the value of the combo cbxDateFrom +6 months

The code I am using is

Private Sub cbxDateFrom_LostFocus()
cbxDateTo.Value = [DateAdd("mmmm", 6, me.cbxDateFrom.Value)]
End Sub

But it does not appear to work in any variant I have tried. If it is easier to do it in properties or event builder I don't mind that, I just need the right syntax

Regards
 
Code:
Private Sub cbxDateFrom_LostFocus()
    Me.cbxDateTo = DateAdd("m", 6, Me.cbxDateFrom)
End Sub
One question though, why the LostFocus event?
 
Excellent, quick response and it works too

Great, thanks very much

Regards
 
Put it in the AfterUpdate event though - not the LostFocus.
 

Users who are viewing this thread

Back
Top Bottom