Results 1 to 2 of 2
  1. #1
    adacpt is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    12

    Using VBA to manipulate properties in a Report


    Hello,
    Using VBA, I need to change the values within the following Report properties:

    Format - Caption

    Event - OnClick

    Data - RecordSource

    It seems like this would be easy, but I can't find examples of the specific commands. I appreciate the help.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Can't change a report once it is rendered. Some properties can be changed before the report renders with code in report OnFormat or Open events.

    This example changes the RecordSource to a string passed to the report with OpenArgs argument of DoCmd.OpenReport:
    Private Sub Report_Open(Cancel As Integer)
    Me.RecordSource = Nz(Me.OpenArgs, Me.RecordSource)
    End Sub

    Here is the code that opens the report and passes sql string to the report:
    DoCmd.OpenReport "SampleList", acViewPreview, , , , Me.ctrSampleList.Form.RecordSource

    Try setting the report caption in the report Open event.

    Why would you need to change property of OnClick event? The event code should be written to handle parameters passed to the report. Where is the OnClick event?
    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. 2-questions regarding data manipulate date:
    By djclntn in forum Queries
    Replies: 6
    Last Post: 08-12-2012, 12:29 PM
  2. inherited properties
    By bginhb in forum Access
    Replies: 1
    Last Post: 03-10-2012, 08:42 PM
  3. Replies: 2
    Last Post: 02-15-2012, 04:04 PM
  4. Replies: 2
    Last Post: 08-20-2009, 07:53 AM
  5. Manipulate DB through VB ...
    By Zoroxeus in forum Programming
    Replies: 2
    Last Post: 12-18-2005, 01:16 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