DateAdd()

PatAccess

Registered User.
Local time
Today, 08:44
Joined
May 24, 2017
Messages
284
Hello Guys,

I am trying to set a field 1 or 2 years out from another date (another field)and I used the DateAdd function but it is giving me an error Error 438 - Object doesn't support this property or method

Here is my code:

Private Sub SetDate_Click()
Dim NewDate As Date
NewDate = DateAdd("y", 1, Me.Expires) 'Me.Expires is the field with old date
SetDate = Me.NewExp
End Sub

What am I doing wrong? :banghead:

Thank you
 
I suspect that the Me.Expires object is not a DateTime field.
 
Try:
NewDate = DateAdd("yyyy", 1, Me.Expires) 'Me.Expires is the field with old date
 
Shouldn't it be
SetDate = NewDate ?
 
Hi. Which line is highlighted when you go to Debug?
 
Hello Guys,
I figured it out.
First of all, I had to declare a new variable Olddate and and assign an existing field to it then I had to make so Olddate = Me.Expires
Then set my field with the new values
Me.NewExp=SetDate

Thank you all
 

Users who are viewing this thread

Back
Top Bottom