Access Form BefroeUpdate If statement

tvman5683

Board Regular
Joined
Mar 23, 2009
Messages
94
Hello!
I'm trying to add an "IF" statement to a BeforeUpdate code on an Access form. If the user enters Date1 I want the Date2 field to populate based on the "Then" code.
The Then code works on it's own but I will have entries that will not have a "Date1". that creates an error. Here's what I tried but didn't seem to work.
If Date 1 is not empty I want to calculate the Friday date 3 weeks previous.
Thanks for any help or ideas on this.

JB

HTML:
If Me![DATE1] <> "" Then Me![DATE2].Value = [DATE1] + 8 - Weekday([WIS DATE], 6) - 21
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Instead of <> "" try using IsNull.
Code:
If Not IsNull(Me![DATE1]) Then 
    Me![DATE2].Value = Me![DATE1].Value + 8 - Weekday(Me![WIS DATE].Value, 6) - 21
End If
 
Upvote 0

Forum statistics

Threads
1,221,831
Messages
6,162,242
Members
451,756
Latest member
tommyw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top