A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Field required only if visible



 
 
Thread Tools Display Modes
  #1  
Old July 13th, 2009, 09:13 PM posted to microsoft.public.access
Bellyjeans
external usenet poster
 
Posts: 22
Default Field required only if visible

Hi there,

I'm trying to wrap my head around something and am wondering if any of
you marvelous guys could help me! I have a combo box and I've coded
it so that if a certain value is selected (the value is "sent to
scope"), a text box becomes visible so that the user can enter a date
(we'll call the value "date to scope"). Is there a possible way to
make it so that the Date to Scope field is a required field but ONLY
if it is visible?

Thanks so much!
  #2  
Old July 13th, 2009, 10:04 PM posted to microsoft.public.access
Dirk Goldgar
external usenet poster
 
Posts: 2,529
Default Field required only if visible

"Bellyjeans" wrote in message
...
Hi there,

I'm trying to wrap my head around something and am wondering if any of
you marvelous guys could help me! I have a combo box and I've coded
it so that if a certain value is selected (the value is "sent to
scope"), a text box becomes visible so that the user can enter a date
(we'll call the value "date to scope"). Is there a possible way to
make it so that the Date to Scope field is a required field but ONLY
if it is visible?



You'd have to do this with code in the form's BeforeUpdate event. Something
like this:

'----- start of example code -----
Private Sub Form_BeforeUpdate(Cancel As Integer)

With Me![Date to Scope]

If .Visible Then

If IsNull(.Value) Then
Cancel = True
.SetFocus
MsgBox _
"Please enter the Date to Scope.", _
vbExclamation, _
"Value Required"
End If

End If

End With

End Sub
'----- end of example code -----

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:14 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.