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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Required Field Code
I am trying to create code that will make a field required depending on the
value of another field. "Priorpap" is a required field and may contain two possible values, either 0 or 1. If "priorpap" is equal to 1 then "ppdate" needs to be a required field. If "priorpap" is equal to 0 then "ppdate" is not required. Any help would be appreciated. |
#2
|
|||
|
|||
Required Field Code
Make "PriorPap" default to zero and "ppdate" an optional field. Put this code in the "before update" event of the form If me.priorpap = 1 Then MsgBox "ppdate is now required", vbCritical Cancel = True Me!ppdate.SetFocus End If I think that should work. -- www.ae911truth.org "3rookerbar" wrote: I am trying to create code that will make a field required depending on the value of another field. "Priorpap" is a required field and may contain two possible values, either 0 or 1. If "priorpap" is equal to 1 then "ppdate" needs to be a required field. If "priorpap" is equal to 0 then "ppdate" is not required. Any help would be appreciated. |
#3
|
|||
|
|||
Required Field Code
If me.priorpap = 1 Then
MsgBox "ppdate is now required", vbCritical Cancel = True Me!ppdate.SetFocus End If And what if ppdate has already been filled in? Won't the above code still fire? Maybe something like If me.priorpap = 1 and IsNull(Me.ppdate) Then MsgBox "ppdate is now required", vbCritical Cancel = True Me!ppdate.SetFocus End If -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000 Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/200707/1 |
Thread Tools | |
Display Modes | |
|
|