Results 1 to 3 of 3
  1. #1
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398

    Using VBA to edit a report

    Using VBA, how do I edit a report? I'm needing to edit the record source.

    Thanks in advance!!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,968
    In the Open event of report can set the RecordSource property to an SQL string. Several methods to pass the string to report.

    One method is with OpenArgs. Example:

    Private Sub Report_Open(Cancel As Integer)
    Me.RecordSource = Nz(Me.OpenArgs, Me.RecordSource)
    End Sub

    Another would be by reference to a global variable.

    Another is to reference the RecordSource property of an open form.

    Another is to reference a control on a form that has the SQL string.

    Another alternative is just passing filter criteria to the report when it opens.

    DoCmd.OpenReport "reportname", , , "ID=" & Me.tbxID
    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
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398
    Thanks, I'll give that a try.

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

Similar Threads

  1. edit a report
    By umenash in forum Access
    Replies: 2
    Last Post: 09-16-2013, 04:06 AM
  2. Cannot Edit Form
    By Derrick T. Davidson in forum Queries
    Replies: 7
    Last Post: 06-16-2013, 07:26 AM
  3. Replies: 1
    Last Post: 05-31-2013, 08:53 AM
  4. Edit chart title on report
    By dougie in forum Programming
    Replies: 0
    Last Post: 12-10-2012, 06:56 AM
  5. Edit tables
    By Surreall in forum Queries
    Replies: 35
    Last Post: 10-20-2012, 12:20 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