Results 1 to 2 of 2
  1. #1
    jgable is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    1

    Printing only a selected drop-down in form mode


    I have my form all set up, but when I select a choice from my drop-down menu (it then populates several other fields) and press print, it prints a form for all possible drop-down items. I would like to disable print in such a way that it only prints the form for the selected drop-down. I am aware of the "print selected" option in print mode, but many other people will be using this who will not know to do that and I don't want hundreds of pages going to waste everytime someone besides me prints.

  2. #2
    huongdl1987 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Posts
    26
    You can form a button click next to the drop-down combo box. Here is an example- of course, in this example, I just pick a word document, not a form. But you get the general idea

    Code:
    Public Function PrintItem(strDocPath As String)
    
    'if no path is passed to function, exit
    
    If IsNull(strDocPath) or strDocPath = "" Then
    Exit Function
    End If
    
    Dim dbs As Database
    Dim objWord As Object
    Dim PrintResponse
    
    Set dbs = CurrentDb
    
    'create reference to Word Object
    
    Set objWord = CreateObject("Word.Application")
    
    PrintResponse = MsgBox("Print this document?", vbYesNo)
    If PrintResponse = vbYes Then
    objWord.ActiveDocument.PrintOut Background:=False
    End If
    
    'release all objects
    Set objWord = Nothing
    Set dbs = Nothing
    
    End Function
    
    Private Sub cmdPrint_Click()
    
    If Not Len(combobox.Value) = 0 Then
    PrintItem(combobox.Value)
    Else
    MsgBox "Select Form"
    End If
    End Sub
    Last edited by June7; 06-13-2012 at 04:40 PM. Reason: fix code tag, use forward slash in end tag

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

Similar Threads

  1. Replies: 10
    Last Post: 10-10-2011, 08:08 PM
  2. Replies: 2
    Last Post: 09-01-2011, 10:48 PM
  3. Replies: 6
    Last Post: 07-10-2011, 05:33 PM
  4. Replies: 4
    Last Post: 01-14-2011, 10:37 AM
  5. Replies: 1
    Last Post: 03-15-2010, 02:52 PM

Tags for this Thread

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