×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Required Field Based on Another Field in Access

Required Field Based on Another Field in Access

Required Field Based on Another Field in Access

(OP)
Hello,

I have a source table in Access 2016. This table has a field called Status and a field called Archived Date.

The Status field is a Lookup field with 2 Values: Active and Archived.

I would like to make the Archived Date field a "required" field if the Archived value is selected in the Status field.
If the other value is selected, the Archived Date field should not be required to be populated.
I used the following code:

If Me.Status = "Archived" Then
If IsNull(Me.Archived_Date) Then
MsgBox "You must enter a date when the Status is Archived.", vbOKOnly
Cancel = True
End If
End If

But after the message appears, it won't allow me to click in the Archived Date field (or anywhere else for that matter) in order to select the date.

Is there anyway to have the cursor automatically go to the Archived Date field so that the date can be selected? Does anyone have any idea how to fix this?

Thank you!

RE: Required Field Based on Another Field in Access

I would probably lock the status field and use a little code in the after update of the ArchiveDate to set the status to archive.

Duane
Minnesota
Hook'D on Access
MS Access MVP 2001-2016

RE: Required Field Based on Another Field in Access

Just to clarify are you saying that after you close the message you can't move the focus to any of the controls on the form? As if they were all disabled/locked? Also what Control and Event is the code running behind?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close