The code for the event proceedure is not working properly and I'm sure that the problem isn't that complicated but I just can't figure it out. I have a simple form with a print results button. When a user clicks the button, the form automatically clears, the record is saved, and a report is supposed to print. The report works properly, the form save and clear works properly, but the print output is a blank page.
Here is the code:
Option Compare Database
Option Explicit
Private Sub CashCheck_AfterUpdate()
Dim chValue As Currency
chValue = Fix(Nz(Me.CashCheck, 0))
Me.CashCheck = chValue
End Sub
Private Sub Form_Open(Cancel As Integer)
'Start a new record when the form is opened
DoCmd.GoToRecord , , acNewRec
End Sub
Private Sub See_Results_Click()
On Error GoTo Err_See_Results_Click
Dim stDocName As String
Dim ccSales As Double
Dim spellNum As String
Dim firstName As String
Dim lastName As String
Dim company As String
Dim Msg As String
Dim Style As VbMsgBoxStyle
Dim Title As String
Dim Response As VbMsgBoxResult
Style = vbOKOnly
Title = "Invalid Information"
stDocName = "PreQualify"
firstName = Nz(Me.ContactFirstName, "")
lastName = Nz(Me.ContactLastName, "")
company = Nz(Me.CompanyName, "")
ccSales = Nz(Me.CreditCards, 0)
If firstName = "" Then
Msg = "Please enter Your First Name."
Response = MsgBox(Msg, Style, Title)
ElseIf lastName = "" Then
Msg = "Please enter Your Last Name."
Response = MsgBox(Msg, Style, Title)
ElseIf company = "" Then
Msg = "Please enter Your Company Name."
Response = MsgBox(Msg, Style, Title)
ElseIf ccSales = 0 Then
Msg = "Please enter Your Average Monthly Credit Card Sales. If you do not accept credit cards your business will not qualify for the factoring program. Your business may be eligible for the bank only financing program. Businesses with healthy cash flow and a minimum of $180,000 in annual sales can get approved for up to 8% of their annualized sales volume with repayment terms of 6 to 18 months."
Response = MsgBox(Msg, Style, Title)
Else
Me.SpellNumber = GetSpellNumber(ccSales * 1.08)
'DoCmd.OpenReport stDocName, acViewPreview
DoCmd.OpenReport stDocName, acViewNormal
DoCmd.GoToRecord , , acNewRec
End If
Exit_See_Results_Click:
Exit Sub
Err_See_Results_Click:
MsgBox Err.Description
Resume Exit_See_Results_Click
End Sub
Private Sub Text47_AfterUpdate()
Dim ccValue As Currency
ccValue = Fix(Nz(Me.CreditCards, 0))
Me.CreditCards = ccValue
End Sub
Can anyone help me figure out why the report is printing a blank page? Is the code not generating the report function for the current record being saved?
Thanks in advance!