Results 1 to 2 of 2
  1. #1
    hannuk is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Dec 2011
    Posts
    9

    newbie question

    Hi, I'm really a newbie using access, so can someone solve this to me:
    I want a button, that prints the current subform record.

    I've managed to get it the button print a subform, but it prints everything
    (the table that I'm using is using foreign key)



    I made the button by going to design, and choosing button. I don't know how to script in access

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Here is some VBA that I use to print the record that is open in a form.

    Code:
    Private Sub Command28_Click()
    On Error GoTo Err_Command28_Click
    
        Dim stDocName As String
    
        stDocName = "Submission"
        'DoCmd.OpenReport stDocName, acNormal, , "[ID] = Forms!frmClients!ID"
        DoCmd.OpenReport stDocName, acViewPreview, , "[ID]=Forms!frmClients!ID"
    
    Exit_Command28_Click:
        Exit Sub
    
    Err_Command28_Click:
        MsgBox Err.Description
        Resume Exit_Command28_Click
        
    End Sub
    Be sure to change the names of your fields, forms and reports to match what is in your db.

    My record ID is ID. The form is named frmClients and the Report is named submission. Put this in the onclick event for the command button.

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

Similar Threads

  1. Hi and a newbie question :)
    By wheelspin in forum Queries
    Replies: 3
    Last Post: 11-28-2011, 01:11 PM
  2. Very Newbie Question
    By paralogical in forum Access
    Replies: 4
    Last Post: 10-11-2010, 06:55 PM
  3. vba question from newbie
    By ninachopper in forum Access
    Replies: 17
    Last Post: 07-29-2010, 01:22 PM
  4. Question from a newbie
    By scarps626 in forum Access
    Replies: 2
    Last Post: 10-02-2009, 03:40 AM
  5. Newbie question
    By The_Dude in forum Programming
    Replies: 2
    Last Post: 12-23-2007, 07:11 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