Results 1 to 4 of 4
  1. #1
    holta is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    2

    Open Report after query

    I am trying to open a report after a user inputs parameter job ID this is a number, in a form. Once this is entered it references a query and pulls all of the people that have applied for the job id. Instead of the query opening up I would like for the report to open. Right now the query opens and then the report ask for a parameter before it will open. Any suggestions?



    Thanks,

    Aaron

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    I use only VBA, not macros. Use WHERE argument:

    DoCmd.OpenReport "reportname", , , "fieldname=" & Me.formcontrolname.
    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
    holta is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    2
    I should have specified this in the post, I am a newbie when it comes to VBA and really access in general. When I add this command to the form on the button it doesn't do anything. When you say fieldname which name are you referring to, the one from the table or the query?

    Thanks,

    Aaron

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    Fieldname that is included in the RecordSource of the report being opened, like JobID. And use your control name in place of the generic alias in my example.

    The code must be put in the VBA editor. Select [Event Procedure] in the Click event property of the button. Double click the ellipses (...) and this will take you to the procedure in the VBA editor. Type code there.
    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.

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

Similar Threads

  1. Open report from query result
    By shank in forum Programming
    Replies: 11
    Last Post: 10-04-2011, 12:59 PM
  2. open report after search
    By shirvo in forum Reports
    Replies: 5
    Last Post: 01-24-2011, 12:21 AM
  3. open a report using VBA from dynamic query?
    By haggisns in forum Programming
    Replies: 3
    Last Post: 10-15-2010, 08:45 AM
  4. Report won't open
    By okakopa in forum Reports
    Replies: 1
    Last Post: 05-24-2010, 04:09 AM
  5. open report from a vb form
    By tracamonali in forum Reports
    Replies: 2
    Last Post: 08-10-2009, 01:55 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