Jacob can you test my code on your machine Thanks, Bob
Private Sub cmdStatement_Click()
'bob's Statements
Dim saveReport As Integer, savFileName As String
Select Case Me.OpenArgs
Case "OwnerStatement"
If IsNull(cbOwnerName.value) = True Or _
cbOwnerName.value = vbNullString Then
MsgBox "Please Select the Owner.", _
vbApplicationModal + vbInformation _
+ vbOKOnly 'added + ( to vbokonlt)
Exit Sub
End If
'**************************************
savFileName = bAutoRenameFile("rptOwnerPaymentMethod.snp") '
'will return "rptOwnerPaymentMethos1.snp",
'"rptOwnerPaymentMethos2.snp"
' etc
savFileName = "C:\Statements\" & savFileName
'savFileName = "C:\Statements\" & "rptOwnerPaymentMethod" _
& ".SNP"
' ***********************************************
DoCmd.OutputTo acOutputReport, "rptOwnerPaymentMethod", _
"Snapshot Format", savFileName, True
' ......... etc
'DoCmd.OpenReport "rptOwnerPaymentMethod", ******
'acViewPreview ********Relaced
'**************************
'DoCmd.Close acForm, Me.Name
Case "MonthlyPaid"
'******************
'Me.Visible = False ******** Not needed
savFileName = "C:\Statements\" & "rptGenericReport" _
& ".SNP"
' Me.Visible = False ****now You dont need this *****
DoCmd.OutputTo acOutputReport, "rptGenericReport", _
"Snapshot Format", savFileName, True
'DoCmd.OpenReport "rptGenericReport", _******* Replaced
'acViewPreview, , , , "MonthlyPaid" ******* Repalce
'**************************************************
'Report_rptGenericReport.tbTotal.value = _
'SUM (Report_rptGenericReport.tbAmount)
'DoCmd.Close acForm, Me.Name
Case "OwnerDue"
Me.Visible = False
DoCmd.OpenReport "rptGenericReport", acViewPreview, , , ,
"OwnerDue"
DoCmd.Close acForm, Me.Name
Case "OwnerPaymentMethod"
If IsNull(cbOwnerName.value) = True Or cbOwnerName.value =
vbNullString Then
MsgBox "Please Select the Owner.", vbApplicationModal +
vbInformation + vbOKOnly
Exit Sub
End If
Me.Visible = False
DoCmd.OpenReport "rptGenericReport", acViewPreview, , , ,
"OwnerPaymentMethod"
DoCmd.Close acForm, Me.Name
Case "PaymentMethod"
Dim nDateDiff As Integer, nSign As Integer
nDateDiff = DateDiff("d", CDate(tbDateFrom.value),
CDate(tbDateTo.value))
nSign = Sgn(nDateDiff)
If nSign = -1 Or nSign = 0 Then
MsgBox "Please Select Date In Proper Range.",
vbApplicationModal + vbExclamation + vbOKOnly
cmdCalenderTo.SetFocus
Exit Sub
End If
Me.Visible = False
DoCmd.OpenReport "rptGenericReport", acViewPreview, , , ,
"PaymentMethod"
DoCmd.Close acForm, Me.Name
Case "PrintInvoiceBatch"
If IsNull(tbDateFrom.value) Or tbDateFrom.value = "" Or
IsNull(tbDateTo.value) Or tbDateTo.value = "" Then
MsgBox "Please Enter the Begining Date and End Date.",
vbApplicationModal + vbInformation + vbOKOnly
Exit Sub
End If
Me.Visible = False
DoCmd.OpenReport "rptInvoiceBatch", acViewPreview, , , ,
"PrintInvoiceBatch"
'DoCmd.Close acForm, Me.Name
Case "PrintStatementBatch"
If IsNull(tbDateFrom.value) Or tbDateFrom.value = "" Or
IsNull(tbDateTo.value) Or tbDateTo.value = "" Then
MsgBox "Please Enter the Begining Date and End Date.",
vbApplicationModal + vbInformation + vbOKOnly
Exit Sub
End If
Me.Visible = False
DoCmd.OpenReport "rptOwnerPaymentMethodBatch", acViewPreview, , , ,
"PrintStatementBatch"
'DoCmd.Close acForm, Me.Name
End Select
'DoCmd.OpenReport "rptInvoiceBatch", acViewPreview, , , ,
"PrintInvoiceBatch"
End Sub