|
-
May 1st, 2011, 09:42 AM
#1
Thread Starter
New Member
Requre field based on combobox value selected
[Access 2010] Require field entry if certain combobox value selected
While googling I found an entry from this forum very similar to my question. However the answer did not exactly work. I have a combobox that has just two choices "open" or "closed", if closed is chosen I want to require a text box (date) to be entered.
The suggested code I used is:
Private Sub opcl_BeforeUpdate(Cancel As Integer)
If opcl = "closed" Then
MsgBox "Please enter date closed", vbOKOnly
compdate.SetFocus
Cancel = True
End If
End Sub
However, this produces the following error message:
Run-Time error 2108
You must save the field before you execute the GoToControl action, the GoTo mtehod, or the SetFocus method.
Thanks in advance!
PS newbie to prgramming in access
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|