P
Pat Dools
Hello,
In my database, I have a simple 'Next' Command Button that needs to execute
two subs. First it must call a Sub in a Module to grab patientID, initials,
etc. from the current Form and then open the next form in the series and
auto-populate patientID, initials, etc. grabbed from the first subroutine.
It opens the next form in the series, but does not auto-populate the fields.
What's missing here? Here is the code behind the Command Button:
Private Sub Form_Current()
Call SetAutoValues(Me)
End Sub
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 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
!studyday = Forms!fScrEligCriteria!studyday
!patient = Forms!fScrEligCriteria!patient
!pat_init = Forms!fScrEligCriteria!pat_init
!site = Forms!fScrEligCriteria!site
End With
SetAutoValues_err:
Resume Next
End Sub
In my database, I have a simple 'Next' Command Button that needs to execute
two subs. First it must call a Sub in a Module to grab patientID, initials,
etc. from the current Form and then open the next form in the series and
auto-populate patientID, initials, etc. grabbed from the first subroutine.
It opens the next form in the series, but does not auto-populate the fields.
What's missing here? Here is the code behind the Command Button:
Private Sub Form_Current()
Call SetAutoValues(Me)
End Sub
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 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
!studyday = Forms!fScrEligCriteria!studyday
!patient = Forms!fScrEligCriteria!patient
!pat_init = Forms!fScrEligCriteria!pat_init
!site = Forms!fScrEligCriteria!site
End With
SetAutoValues_err:
Resume Next
End Sub