What i have on my Form is three buttons one for report view another for outputto and the final one is sendobject. All of them work when clicked on although i am trying to figure out how i can get the information on my form to filter the sendobject and outputto buttons. This is my code for the report button how do i make this work with the other two?
Code:
Private Sub cmdPreview_Click()
Dim strtype, strwhere, strDateField, strsubtype, strname As String
Const strcJetDate = "\#mm\/dd\/yyyy\#"
strDateField = "[DateDue]"
strname = "[Name]"
strsubtype = "[Type]"
strtype = Me.txtType
If Not IsNull(Me.txtsubtype) Then
strwhere = strwhere & " (" & strsubtype & " = " & (Me.txtsubtype) & ") AND "
End If
If Not IsNull(Me.txtName) Then
strwhere = strwhere & " (" & strname & " = '" & (Me.txtName) & "') AND "
End If
If IsDate(Me.txtStartDate) Then
strwhere = strwhere & " (" & strDateField & " >= " & Format(Me.txtStartDate, strcJetDate) & ") "
End If
If IsDate(Me.txtEndDate) Then
If strwhere <> vbNullString Then
strwhere = strwhere & " AND "
End If
strwhere = strwhere & "(" & strDateField & " < " & Format(Me.txtEndDate + 1, strcJetDate) & ") "
End If
DoCmd.OpenReport strtype, acViewPreview, , strwhere
DoCmd.Close acForm, "Report", acSaveNo