B
BonnieW via AccessMonster.com
This code should work, I think, but there's got to be a better way to do this
than a million IFs. Anyone have any suggestions?
If IsNull(Activity.Value) Then
MsgBox "Missing Required Field - Activity!"
ElseIf IsNull(EffortDate.Value) Then
MsgBox "Missing Required Field - Effort Date!"
ElseIf IsNull(Hours.Value) Then
MsgBox "Missing Required Field - Hours!"
ElseIf IsNull(PeopleType.Value) Then
MsgBox "Missing Required Field - PeopleType!"
Else
DoCmd.Save
If Activity.Value = "Trail Work" Then
DoCmd.OpenForm "frmTrailWorkEntry", , , , acFormAdd
ElseIf Activity.Value = "Invasives Control" Then
DoCmd.OpenForm "frmInvasivesControlCrewNew", , , , acFormAdd
ElseIf Activity.Value = "Revegetation" Then
DoCmd.OpenForm "frmRevegetationNew", , , , acFormAdd
Else
DoCmd.GoToRecord , , acNewRec
'Refresh
Forms!tablepeople.SetFocus
MsgBox "Your record has been saved! Please choose your next
volunteer or enter additional information.", vbOKOnly, "Hooray!"
End If
Thanks in advance for any advice or suggestions!
than a million IFs. Anyone have any suggestions?
If IsNull(Activity.Value) Then
MsgBox "Missing Required Field - Activity!"
ElseIf IsNull(EffortDate.Value) Then
MsgBox "Missing Required Field - Effort Date!"
ElseIf IsNull(Hours.Value) Then
MsgBox "Missing Required Field - Hours!"
ElseIf IsNull(PeopleType.Value) Then
MsgBox "Missing Required Field - PeopleType!"
Else
DoCmd.Save
If Activity.Value = "Trail Work" Then
DoCmd.OpenForm "frmTrailWorkEntry", , , , acFormAdd
ElseIf Activity.Value = "Invasives Control" Then
DoCmd.OpenForm "frmInvasivesControlCrewNew", , , , acFormAdd
ElseIf Activity.Value = "Revegetation" Then
DoCmd.OpenForm "frmRevegetationNew", , , , acFormAdd
Else
DoCmd.GoToRecord , , acNewRec
'Refresh
Forms!tablepeople.SetFocus
MsgBox "Your record has been saved! Please choose your next
volunteer or enter additional information.", vbOKOnly, "Hooray!"
End If
Thanks in advance for any advice or suggestions!