Yes this is the 1st form I created to go to the second form. I would like to put it all on one click.
Option Compare Database
Private Sub cmdPDF_Click()
On Error GoTo Err_Handler
Const MESSAGE_TEXT1 = "No current DATA."
Const MESSAGE_TEXT2 = "No folder set for storing PDF files."
Dim strFullPath As String
Dim varFolder As Variant
strTest = Me.LstTerm.Value
MsgBox (strTest)
If Not IsNull(Me.LstTerm) Then
' build path to save PDF file
varFolder = DLookup("Folderpath", "pdfFolder")
strFullPath = varFolder & "\" & Me.cmdPDF_.Column(1) & "FALL-COHORT" & ".pdf"
' ensure current record is saved before creating PDF file
Me.Dirty = False
DoCmd.OutputTo acOutputReport, "FALL-COHORT", acFormatPDF, strFullPath, True
End If
Else
MsgBox MESSAGE_TEXT1, vbExclamation, "Invalid Operation"
End If
Exit_Here:
Exit Sub
Err_Handler:
MsgBox Err.Description
Resume Exit_Here
End Sub
Private Sub LstTerm_Click()
DoCmd.OpenForm "startup2", , , , acViewPreview
End Sub
Private Sub LstTerm_DblClick(Cancel As Integer)
Dim strTest As String
DoCmd.OpenForm "startup2", , , , acViewPreview
strTest = "Click Open Report to pdf the Fall Cohort Retention by Term selected"
MsgBox (strTest)
End Sub
this is for the second form
Private Sub cmdPDF_Click()
On Error GoTo Err_Handler
Const MESSAGE_TEXT1 = "No current Year."
Dim strFullPath As String
Dim varFolder As Variant
If Not IsNull(Me.Term) Then
' build path to save PDF file
varFolder = DLookup("Folderpath", "pdfFolder")
If IsNull(varFolder) Then
MsgBox MESSAGE_TEXT2, vbExclamation, "Invalid Operation"
Else
strFullPath = varFolder & "\" & Me.Term & " " & "FALL-COHORT" & ".pdf"
' ensure current record is saved before creating PDF file
Me.Dirty = False
DoCmd.OutputTo acOutputReport, "FALL-COHORT", acFormatPDF, strFullPath, True
End If
Else
MsgBox MESSAGE_TEXT1, vbExclamation, "Invalid Operation"
End If
Exit_Here:
Exit Sub
Err_Handler:
MsgBox Err.Description
Resume Exit_Here
End Sub