P
Pat Dools
Hello,
I am getting the above error message when I click on a Command Button in one
of my forms 'fCycDoseVitalAmp' to proceed to another form
'fCycDoseVitalAmpFU' (see code):
Private Sub CommandGoToAmpFU_Click()
'DoCmd.OpenForm "fCycDoseVitalAmpFU", acNormal, , , acFormAdd, acDialog
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.cyclenum.Value & "") = 0 Then
MsgBox "You must enter a value into Cycle."
Me.cyclenum.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.OpenForm "FCycDoseVitalAmpFU", acNormal
DoCmd.GoToRecord acDataForm, "FCycDoseVitalAmpFU", acNewRec
Call ClearControls(Me)
DoCmd.GoToControl "nofollowup"
DoCmd.Close acForm, "fCycDoseVitalAmp"
End If
End Sub
The odd thing is, this error message ONLY pops up when the table
associated with 'Follow Up' is completely empty. In other words, as soon as
I enter one record into this 'Follow Up' table, this error message does not
occur (unless there is a Key violation). When debugging, the code bombs out
at this line:
DoCmd.GoToRecord acDataForm, "FCycDoseVitalAmpFU", acNewRec
-- clearly when it is designating the Record as 'new'. In the table, I have
2 fields with default values, one of which is part of a 2-field Key. Is
there a problem having a Default Value in a field that is part of the Key
(and has 'Required' set to 'yes' and Index to 'Yes (No Duplicates)? I've
tried taking this Default Value out, and deleting and re-adding the control
to the Form, but it still bombs out the same way.
I'm stumped as to why this error occurs when the table is completely empty,
but is fine once it has one record in it. Any ideas are appreciated!
Thanks.
I am getting the above error message when I click on a Command Button in one
of my forms 'fCycDoseVitalAmp' to proceed to another form
'fCycDoseVitalAmpFU' (see code):
Private Sub CommandGoToAmpFU_Click()
'DoCmd.OpenForm "fCycDoseVitalAmpFU", acNormal, , , acFormAdd, acDialog
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.cyclenum.Value & "") = 0 Then
MsgBox "You must enter a value into Cycle."
Me.cyclenum.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.OpenForm "FCycDoseVitalAmpFU", acNormal
DoCmd.GoToRecord acDataForm, "FCycDoseVitalAmpFU", acNewRec
Call ClearControls(Me)
DoCmd.GoToControl "nofollowup"
DoCmd.Close acForm, "fCycDoseVitalAmp"
End If
End Sub
The odd thing is, this error message ONLY pops up when the table
associated with 'Follow Up' is completely empty. In other words, as soon as
I enter one record into this 'Follow Up' table, this error message does not
occur (unless there is a Key violation). When debugging, the code bombs out
at this line:
DoCmd.GoToRecord acDataForm, "FCycDoseVitalAmpFU", acNewRec
-- clearly when it is designating the Record as 'new'. In the table, I have
2 fields with default values, one of which is part of a 2-field Key. Is
there a problem having a Default Value in a field that is part of the Key
(and has 'Required' set to 'yes' and Index to 'Yes (No Duplicates)? I've
tried taking this Default Value out, and deleting and re-adding the control
to the Form, but it still bombs out the same way.
I'm stumped as to why this error occurs when the table is completely empty,
but is fine once it has one record in it. Any ideas are appreciated!
Thanks.