P
Pat Dools
Hello, I have forms set up in a series in my database, and in the first form,
I have the following code behind a Command Button to move you to the next
form:
Private Sub CommandBeginSeries_Click()
On Error GoTo Err_BeginSeries_Click
Dim strSQL As String, strName As String, rst As DAO.Recordset, dbs As Database
Set dbs = CurrentDb
strSQL = "SELECT * FROM [LU_Forms] WHERE [FormOrder] = 2"
Set rst = dbs.OpenRecordset(strSQL)
DoCmd.OpenForm rst![FormName], , , , acAdd
Exit_BeginSeries_Click:
Exit Sub
Err_BeginSeries_Click:
MsgBox Err.Description
Resume Exit_BeginSeries_Click
End Sub
As the next form is opened, it looks back to the four header fields and
auto-fills them on the next form in the series based on the values present in
the initial form (see code):
Private Sub Form_Current()
If Me.NewRecord Then
Call SetAutoValues(Me)
End If
Sub SetAutoValues(frm As Form)
On Error GoTo SetAutoValues_err
' Set Automatic Values in each form in series
' Add as many fields as necessary (make sure each field has the same
name on EVERY form)
With frm
!id = Forms!fScrEligCriteria!id
!ptin = Forms!fScrEligCriteria!ptin
!site = Forms!fScrEligCriteria!site
End With
SetAutoValues_err:
'MsgBox Err.Description
Resume Next
End Sub
Is there a way to check to see if a record already exists as this second
form in the series is opened, and if there is, then data entry person
receives a messages and is brought back to initial form in series? The way
it works now, a new record is brought up using the second form in series, and
data entry person is allowed to enter information, but none of it gets saved
(which is good). BUT the data entry person is never alerted they are trying
to enter info. they will not be allowed to save. This could save them some
time.
Thanks,
I have the following code behind a Command Button to move you to the next
form:
Private Sub CommandBeginSeries_Click()
On Error GoTo Err_BeginSeries_Click
Dim strSQL As String, strName As String, rst As DAO.Recordset, dbs As Database
Set dbs = CurrentDb
strSQL = "SELECT * FROM [LU_Forms] WHERE [FormOrder] = 2"
Set rst = dbs.OpenRecordset(strSQL)
DoCmd.OpenForm rst![FormName], , , , acAdd
Exit_BeginSeries_Click:
Exit Sub
Err_BeginSeries_Click:
MsgBox Err.Description
Resume Exit_BeginSeries_Click
End Sub
As the next form is opened, it looks back to the four header fields and
auto-fills them on the next form in the series based on the values present in
the initial form (see code):
Private Sub Form_Current()
If Me.NewRecord Then
Call SetAutoValues(Me)
End If
Sub SetAutoValues(frm As Form)
On Error GoTo SetAutoValues_err
' Set Automatic Values in each form in series
' Add as many fields as necessary (make sure each field has the same
name on EVERY form)
With frm
!id = Forms!fScrEligCriteria!id
!ptin = Forms!fScrEligCriteria!ptin
!site = Forms!fScrEligCriteria!site
End With
SetAutoValues_err:
'MsgBox Err.Description
Resume Next
End Sub
Is there a way to check to see if a record already exists as this second
form in the series is opened, and if there is, then data entry person
receives a messages and is brought back to initial form in series? The way
it works now, a new record is brought up using the second form in series, and
data entry person is allowed to enter information, but none of it gets saved
(which is good). BUT the data entry person is never alerted they are trying
to enter info. they will not be allowed to save. This could save them some
time.
Thanks,