0
votes

I currently use access to store and easily manage gym memberships and customer information etc. I have 3 forms where employees can add a new member, view a current member, and a home page where they can run various other functions like run reports on expired memberships etc.

On the profile form which is what is opened when a member is selected there is an expiry date field which is the date the customers membership expires on. Up until now the employees of the gym have just been manually typing the date +1 month when a customer pays their membership however there have been a few mistakes.

What im trying to do is to create a button which will simply insert todays date +1 month into the expiry text field. To do this i have created a button and use the following VBA Code however this only adds one day, not 1 month, i cant simply add +30 as different months have a different number of days.

++Start VBA Code++

Private Sub cmdAddDate_Click()
On Error GoTo ErrorAddDate

    Me.Expiry = Date + 1

ExitAddDate:
    Exit Sub

ErrorAddDate:
    MsgBox Error.Description
    Resume ExitAddDate
End Sub

++End VBA Code++

i can host a copy of the database on my FTP Server if needed but customer information will have to be removed of course.

Thanks in advanced.

1

1 Answers

0
votes

Use the DateAdd function:

Me.Expiry = DateAdd("m", 1, Date)