Results 1 to 6 of 6
  1. #1
    Stika is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2012
    Posts
    18

    Print report command button

    Hi,

    I cant seem to get my head around this..I need to create a strWhere that will print the report if a checkbox isnt ticked.

    This is my current command button code

    Private Sub Command37_Click()
    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 "Connote1", acNormal, , strWhere
    End If
    DoCmd.GoToRecord acDataForm, "Connote", acNewRec
    End Sub

    The Control Source is Manifest and the form label is Check52

    In the Table it come up yes if I tick it and no If I dont...I want it to only print if checkbox is not ticked otherwise save and goto new record

    I hope that makes sense

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Manifest is the yes/no field that checkbox is bound to?

    You only want to open the report if the checkbox is no?

    How is a label relevant?

    If Me.Manifest = False Then DoCmd.OpenReport "Connote1", acNormal, , "[ID] = " & Me.[ID]
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Stika is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2012
    Posts
    18
    Quote Originally Posted by June7 View Post
    Manifest is the yes/no field that checkbox is bound to?
    Yes it is

    You only want to open the report if the checkbox is no?
    Thats correct

    How is a label relevant?
    I just havent given it a name yet

    If Me.Manifest = False Then DoCmd.OpenReport "Connote1", acNormal, , "[ID] = " & Me.[ID]
    Does that mean I get rid of the dim strwhere?

  4. #4
    Stika is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2012
    Posts
    18
    Ok, Now I have another problem but its along the same lines....

    I Dont want it to open the report I just want it to print it and goto new record...But now I have built a navigation panel and it will print but wont goto new record

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Use strWhere variable if you want. I don't usually bother with variables if only using the value once.

    The acNormal will cause report to open direct to printer.

    You mean a navigation form? I don't use navigation form. Review https://www.accessforums.net/reports...ort-30886.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    Stika is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2012
    Posts
    18
    Its alright...ive gone again doing navigation form from with wizzard and created a menu instead...Works well for me

    Thanks

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

Similar Threads

  1. Print Preview Command Button Locks Access
    By DanKoz in forum Access
    Replies: 7
    Last Post: 03-19-2018, 12:34 PM
  2. Replies: 7
    Last Post: 09-04-2012, 02:51 PM
  3. Replies: 2
    Last Post: 04-02-2012, 04:34 AM
  4. Replies: 5
    Last Post: 08-22-2011, 11:24 AM
  5. Replies: 0
    Last Post: 02-22-2011, 05:04 AM

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