Results 1 to 2 of 2
  1. #1
    bobchill is offline Novice
    Windows 7 32bit Access 2003
    Join Date
    Jul 2011
    Posts
    1

    Event Proceedure Problem. Please help!

    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!

  2. #2
    ketbdnetbp is offline Competent Performer
    Windows 7 32bit Access 2003
    Join Date
    Mar 2011
    Location
    Midwest
    Posts
    254

    bobchill -

    You could try...

    Code:

    ...Else
    Me.SpellNumber = GetSpellNumber(ccSales * 1.08)
    'DoCmd.OpenReport stDocName, acViewPreview


    If Me.Dirty Then Me.Dirty = False

    DoCmd.OpenReport stDocName, acViewNormal

    DoCmd.GoToRecord , , acNewRec
    End If

    It appears as though the data is still in the buffer, not written to table when you open the report. Timing issue. It writes the data to the table when you navigate to the new record which happens after you open the report.

    Hope this helps,

    Jim

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Help on an event...
    By allykid in forum Forms
    Replies: 4
    Last Post: 03-15-2011, 11:25 AM
  2. Event Calendar Help
    By Nosaj08 in forum Forms
    Replies: 9
    Last Post: 06-11-2010, 11:19 AM
  3. Event procedures
    By GIS_Guy in forum Forms
    Replies: 1
    Last Post: 05-11-2010, 02:34 PM
  4. OnClick event
    By HotTomales in forum Forms
    Replies: 1
    Last Post: 12-24-2009, 08:10 PM
  5. Replies: 21
    Last Post: 06-03-2009, 05:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums