P
Pat Dools
Hello,
I have the following code that is set behind a 'New Record' Command button
at the footer of the form that I wish to 1) Save the record that has been
entered (after checking for 'Required' fields), 2) then open a New Record.
Is the 'Save' portion of this code done correctly? Thank you.
Private Sub CommandNewRecord_Click()
If Len(Me.site.Value & "") = 0 Then
MsgBox "You must enter a value into Site Number."
Me.site.SetFocus
ElseIf Len(Me.id.Value & "") = 0 Then
MsgBox "You must enter a value into Patient Number."
Me.id.SetFocus
ElseIf Len(Me.ptin.Value & "") = 0 Then
MsgBox "You must enter a value into Patient Initials."
Me.ptin.SetFocus
ElseIf Len(Me.course.Value & "") = 0 Then
MsgBox "You must enter a value into Course."
Me.course.SetFocus
ElseIf Len(Me.vs_Adoseday.Value & "") = 0 Then
MsgBox "You must enter a value into Cycle."
Me.vs_Adoseday.SetFocus
ElseIf Len(Me.data1_init.Value & "") = 0 Then
MsgBox "You must enter a value into Data Entry 1 Initials."
Me.data1_init.SetFocus
Else
DoCmd.Save acForm, "FCycDoseVitalAmp"
DoCmd.OpenForm "FCycDoseVitalAmp", acNormal
DoCmd.GoToRecord acDataForm, "FCycDoseVitalAmp", acNewRec
DoCmd.GoToControl "course"
End If
End Sub
I have the following code that is set behind a 'New Record' Command button
at the footer of the form that I wish to 1) Save the record that has been
entered (after checking for 'Required' fields), 2) then open a New Record.
Is the 'Save' portion of this code done correctly? Thank you.
Private Sub CommandNewRecord_Click()
If Len(Me.site.Value & "") = 0 Then
MsgBox "You must enter a value into Site Number."
Me.site.SetFocus
ElseIf Len(Me.id.Value & "") = 0 Then
MsgBox "You must enter a value into Patient Number."
Me.id.SetFocus
ElseIf Len(Me.ptin.Value & "") = 0 Then
MsgBox "You must enter a value into Patient Initials."
Me.ptin.SetFocus
ElseIf Len(Me.course.Value & "") = 0 Then
MsgBox "You must enter a value into Course."
Me.course.SetFocus
ElseIf Len(Me.vs_Adoseday.Value & "") = 0 Then
MsgBox "You must enter a value into Cycle."
Me.vs_Adoseday.SetFocus
ElseIf Len(Me.data1_init.Value & "") = 0 Then
MsgBox "You must enter a value into Data Entry 1 Initials."
Me.data1_init.SetFocus
Else
DoCmd.Save acForm, "FCycDoseVitalAmp"
DoCmd.OpenForm "FCycDoseVitalAmp", acNormal
DoCmd.GoToRecord acDataForm, "FCycDoseVitalAmp", acNewRec
DoCmd.GoToControl "course"
End If
End Sub