Results 1 to 2 of 2

Thread: Using VB code in Access

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 1999
    Location
    Springfield, Virginia
    Posts
    1

    Post

    Using Visual Basic in Microsoft Access does anyone know how to use a command button to print a predefined Report?

    I need to print a report based on the month a user provides (I'm using an InputBox for this). Once they enter the month I need to (using VB code) run a query and run a report. I want this automated so the user only has to click on the button and supply the month. I don't know how to link a CommandButton to a Report in Access. Any help would really be appreciated.

  2. #2
    New Member
    Join Date
    Jul 1999
    Posts
    2

    Post

    try

    DoCmd.OpenReport "rptName",acViewPreview,,"[Month]='" & sMonth & "'"

    You must have your query saved as the record source of the report... it doesn't need to have month as a parameter but it has to have the Month field in the select

    Bash

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width