Fields must be populated depending on option chosen

  • Thread starter Thread starter Bryan
  • Start date Start date
B

Bryan

I have a form that has a field called "Reason Codes". Now
depending on which option they pick from the "reason
codes" will determine other fields that need to be filled
out.

An example:

If they choose: "In-eligible" they must fill out
the "eligible date" column.

If they choose: Disconnected they must fill out
the "Name", "date", "comments" sections.

There are around 6 instances in "Reason Codes" but this
should pretty much cover it. Am I making this too
complicated? I'm having a hard time with users not filling
out the appropriate boxes no matter how many times we
educate them. Every month I must go through and send out
what needs to be corrected and it has become a nightmare.

Thanks,
 
Hi, Bryan.

I think that I would use the Form Before Update event,
with a Select Case statement on your Reason Codes
control. Note the code is untested, and may require
additional error-checking:

Select Case Me![Reason Codes]

' I'm assuming this field is text
' If it's a numerical code replace the string
' with the appropriate code

Case "In-Eligible"
' Test field(s) for Null
If IsNull (Me![IneligibleDate]) Then
MsgBox "Please fill complete Ineligible Date field."
Cancel = True
Me![IneligibleDate].SetFocus
End If
Case...etc.
Case...etc.
End Select

HTH
Kevin Sprinkel
 
Another thing you could do to hi-light the required fields is change the label
font color and style to red/bold for the required controls using the
AfterUpdate event of the "Reason Codes" combo box.

Then in the Form Before Update event, after you check the fields (see Kevin's
code example), set the font color back to black/normal.



HTH
--
Steve
--------------------------------
"Veni, Vidi, Velcro"
(I came, I saw, I stuck around.)



Kevin said:
Hi, Bryan.

I think that I would use the Form Before Update event,
with a Select Case statement on your Reason Codes
control. Note the code is untested, and may require
additional error-checking:

Select Case Me![Reason Codes]

' I'm assuming this field is text
' If it's a numerical code replace the string
' with the appropriate code

Case "In-Eligible"
' Test field(s) for Null
If IsNull (Me![IneligibleDate]) Then
MsgBox "Please fill complete Ineligible Date field."
Cancel = True
Me![IneligibleDate].SetFocus
End If
Case...etc.
Case...etc.
End Select

HTH
Kevin Sprinkel

-----Original Message-----
I have a form that has a field called "Reason Codes". Now
depending on which option they pick from the "reason
codes" will determine other fields that need to be filled
out.

An example:

If they choose: "In-eligible" they must fill out
the "eligible date" column.

If they choose: Disconnected they must fill out
the "Name", "date", "comments" sections.

There are around 6 instances in "Reason Codes" but this
should pretty much cover it. Am I making this too
complicated? I'm having a hard time with users not
filling

out the appropriate boxes no matter how many times we
educate them. Every month I must go through and send out
what needs to be corrected and it has become a nightmare.

Thanks,
.
 
Back
Top