P
Pat Dools
Hello,
I have a series of forms in a database that I progress thru by clicking on a
'Next' Command Button present on the form that opens up the next form in the
series based the 'id' field in the 'initial' form ('fScrEligCriteria') in the
series (see code below):
Private Sub Next_Click()
On Error GoTo Err_Next_Click
Call OpenNextForm(Me.Name)
Exit_Next_Click:
Exit Sub
Err_Next_Click:
DoCmd.Close acForm, Me.Name
Resume Exit_Next_Click
End Sub
Sub OpenNextForm(strName As String)
Dim intOrder As Integer, frmName As String
On Error GoTo OpenNextForm_Err
intOrder = DLookup("[FormOrder]", "LU_Forms", "[FormName]= '" & strName
& "'")
frmName = DLookup("[FormName]", "LU_Forms", "[FormOrder]= " & intOrder
+ 1)
If Not IsNull(frmName) Then
DoCmd.OpenForm frmName, , , "[id] = Forms.fScrEligCriteria.id"
'DoCmd.OpenForm frmName, , , , acAdd
End If
DoCmd.Close acForm, strName
OpenNextForm_Err:
'MsgBox Err.Description
Resume Next
End Sub
It works great, but the thing is that if a required field is not filled out,
hitting next still allows the user to progress to the next form and does not
alert the data entry person that a required field has not been filled out.
It does not save the record in the underlying table (which is good). I
un-commented out the error section of the code in the OpenNextForm sub:
OpenNextForm_Err:
'MsgBox Err.Description
Resume Next
but, all is says is 'Object doesn't support this property or method'-- which
I'm not sure why this error message comes up, since data entry into this
database, progressing thru the forms using this 'Next' Command Button seems
to work just fine.
I would like my data entry people to receive a notification when they are
trying to progress to the next form in the series if they are missing one of
these required fields. How can I make this happen?
Thank you.
I have a series of forms in a database that I progress thru by clicking on a
'Next' Command Button present on the form that opens up the next form in the
series based the 'id' field in the 'initial' form ('fScrEligCriteria') in the
series (see code below):
Private Sub Next_Click()
On Error GoTo Err_Next_Click
Call OpenNextForm(Me.Name)
Exit_Next_Click:
Exit Sub
Err_Next_Click:
DoCmd.Close acForm, Me.Name
Resume Exit_Next_Click
End Sub
Sub OpenNextForm(strName As String)
Dim intOrder As Integer, frmName As String
On Error GoTo OpenNextForm_Err
intOrder = DLookup("[FormOrder]", "LU_Forms", "[FormName]= '" & strName
& "'")
frmName = DLookup("[FormName]", "LU_Forms", "[FormOrder]= " & intOrder
+ 1)
If Not IsNull(frmName) Then
DoCmd.OpenForm frmName, , , "[id] = Forms.fScrEligCriteria.id"
'DoCmd.OpenForm frmName, , , , acAdd
End If
DoCmd.Close acForm, strName
OpenNextForm_Err:
'MsgBox Err.Description
Resume Next
End Sub
It works great, but the thing is that if a required field is not filled out,
hitting next still allows the user to progress to the next form and does not
alert the data entry person that a required field has not been filled out.
It does not save the record in the underlying table (which is good). I
un-commented out the error section of the code in the OpenNextForm sub:
OpenNextForm_Err:
'MsgBox Err.Description
Resume Next
but, all is says is 'Object doesn't support this property or method'-- which
I'm not sure why this error message comes up, since data entry into this
database, progressing thru the forms using this 'Next' Command Button seems
to work just fine.
I would like my data entry people to receive a notification when they are
trying to progress to the next form in the series if they are missing one of
these required fields. How can I make this happen?
Thank you.