Sub in Module not executing?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top