Results 1 to 14 of 14
  1. #1
    dmon2010 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2013
    Posts
    39

    Print buttons arent working now.

    Hi, I was using this access project and everything was fine and working correctly. However, I needed to add a couple of new forms and some buttons and now my print buttons are not working. Can someone take a look if possible?

    Thanks for any help...Order Entry.zip

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    A couple of things..
    1..
    I assume you mean the default form "ORDER ENTRY"
    all buttons seem to be coded correctly...I dont see any problems. They should work.
    now, it could be the REPORT connected to the print button
    Try running the report manually to see if you get results.

    2...
    BUT your various info boxes on the form:
    administered by
    payment
    ship to
    they are using DLOOKUPs (not good..could get slow)
    The BEST method is they should each be a query (faster) to retrieve the data.

    BUT IF IT WORKS...GO WITH GOD.

  3. #3
    dmon2010 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2013
    Posts
    39
    When I click a button I get this error msg: Compile Error Invalid Outside Procedure.

    Edit:

    I get this code:

    Option Compare Database


    Dim strWhere As String


    If Me.Dirty Then 'Save any edits.
    Me.Dirty = False
    End If


    If Me.NewRecord Then 'Check there is a record to print
    MsgBox "Select a record to print"
    Else
    strWhere = "[ID] = " & Me.[ID]
    DoCmd.OpenReport "BoL", acViewPreview, , strWhere
    End If




    End Sub


    Where the first "Me" is highlighted...

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    Those damn dirty Me.Dirty could never work right for me.
    TAKE'EM OUT!

    All of them.

  5. #5
    dmon2010 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2013
    Posts
    39
    Take out anything that says "Me.Dirty"? Or any entire line that contains "
    Me.Dirty"?

    EDIT:

    Take out all of these?:

    If Me.Dirty Then 'Save any edits.
    Me.Dirty = False
    End If

  6. #6
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    Yes. that whole block.
    Dont know why they keep adding them...they keep failing

  7. #7
    dmon2010 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2013
    Posts
    39
    Took it out, but it still doesn't work. Now it gets caught on this:

    If Me.NewRecord Then 'Check there is a record to print
    MsgBox "Select a record to print"
    Else
    strWhere = "[ID] = " & Me.[ID]
    DoCmd.OpenReport "BoL", acViewPreview, , strWhere
    End If

    Where the first "Me" is highlighted again...

  8. #8
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    Ah...its a misdirection. The error is that the code has no SUB NAME.

    Code:
    Sub Bob()
    Dim strWhere As String
    '    If Me.Dirty Then    'Save any edits.
    '        Me.Dirty = False
    '    End If
        'If Me.NewRecord Then    'Check there is a record to print
        '    MsgBox "Select a record to print"
        'Else
           strWhere = "[ID] = " & Me.[ID]
            DoCmd.OpenReport "BoL", acViewPreview, , strWhere
        'End If
    End Sub
    The name of the SUB was missing...I added sub BOB(). You can add whatever...then it worked.

  9. #9
    dmon2010 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2013
    Posts
    39
    ok, what would I change Bob() to?

  10. #10
    dmon2010 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2013
    Posts
    39
    This is what the code looks like now:

    Private Sub Command87_Click()
    Dim strWhere As String
    If Me.NewRecord Then 'Check there is a record to print
    MsgBox "Select a record to print"
    Else
    strWhere = "[ID] = " & Me.[ID]
    DoCmd.OpenReport "DD250", acViewPreview, , strWhere
    End If
    End Sub

    But when I click the button I get the error msg and the code that I posted earlier...

  11. #11
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    Hmmm...My copy works...what button did you click?

    All that's needed for a print button to work is:

    strWhere = "[ID] = " & Me.[ID]
    DoCmd.OpenReport "DD250", acViewPreview, , strWhere

    But I cant find Me.[ID] field.
    you can replace it with whatever the control contains the ID. This is weird!

  12. #12
    dmon2010 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2013
    Posts
    39
    I deleted the button and created a new one. I only used this:

    strWhere = "[ID] = " & Me.[ID]
    DoCmd.OpenReport "DD250", acViewPreview, , strWhere

    But still not working. Now I'm still getting compile error and stuck on:
    "[ID] = "

    EDIT:

    Okay, I deleted the very last form that I had created, before this started acting up, and now my buttons are working again. Everythings good. That form only had 2 other buttons on it... thoughts?

  13. #13
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    I never figued out where Me.[ID] was. It wasnt on the form. ??!!

  14. #14
    dmon2010 is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2013
    Posts
    39
    no, it wasnt. this was weird. I really appreciate you time and help though. Thanks!

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

Similar Threads

  1. Replies: 15
    Last Post: 04-09-2014, 02:29 PM
  2. Hiding buttons on Print of Report
    By CS_10 in forum Reports
    Replies: 3
    Last Post: 04-08-2014, 07:52 AM
  3. Replies: 3
    Last Post: 01-29-2013, 04:34 AM
  4. Replies: 5
    Last Post: 10-26-2011, 02:59 PM
  5. All Buttons Stopped Working and...
    By rhoridge in forum Programming
    Replies: 1
    Last Post: 12-02-2010, 11:25 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