How to move image on report using Detail OnFormat Event?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Al Akers
    New Member
    • Nov 2010
    • 5

    How to move image on report using Detail OnFormat Event?

    I have a problem of changing the placement of an embedded image for a report/print. The initial left measurement of the image format is set to 0. I desire to move the image to the right during a Detail section On Format Event.
    Starting with a simple command to move the embedded OLE field 1 inch to the right I have set up a Detail On Format Event of:

    Code:
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Me.[Image].Left = 1440
    End Sub
    However, the print output does not move the image. The field name is [Image] and does not have any fields or other information on the right side of it on the Detail section. Once I know this works I will add smarter testing and improve my form, but this simple
    Event command does not work for me.
    Last edited by MMcCarthy; Nov 25 '10, 06:29 PM.
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    Are you sure that Image is the name of the image frame on the report? In design view check the properties of the image frame, in particular the name property which is located on the Other tab.

    Also open the form in preview rather than normal when testing this.

    Comment

    • TheSmileyCoder
      Recognized Expert Moderator Top Contributor
      • Dec 2009
      • 2322

      #3
      What MMcCarthy wrote is good advice, im just adding to it:
      When debugging, You should always start by making sure the event is firing. Add a msgbox or debug statement to your code, and verify that the event is firing. If it is firing, check post #2. If it is not firing, and your using Ac2007, make sure to open report in Preview, not in layout.

      Comment

      • Al Akers
        New Member
        • Nov 2010
        • 5

        #4
        Still no change. Good idea to put tracers in the Event. I did change the names of my Report fields (Property Sheet/Other/Name) to be different from the table field names in case there was confusion. I modified my On Format Event to say:
        Code:
        Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
        Me.OLEimage.Left = 1440 ' one inch in TWIPS
        Me.LastName.Left = 1440 '
        Debug.Print "Me.OLEimage.Left: " & Me.OLEimage.Left
        MsgBox "Me.OLEimage.Left: " & Me.OLEimage.Left
        End Sub
        This should move both the image and name fields from the default 0 inch to 1 inch from the left on the report. I then click -Debug/Compile members- and have no errors there. My weakness now is understanding how to render the feedback onto my Visual Basic tools window. Just Print Previewing does nor populate Immediate or Watches windows with information (I don't understand how to associate the tools to the event). Sorry to be such a novice about these things. This seemed like a simple table and report when I started, and I am determined to have it my way. I am refusing to port the table into MS Word for the output.
        Last edited by MMcCarthy; Nov 25 '10, 06:29 PM. Reason: added code tags

        Comment

        • Al Akers
          New Member
          • Nov 2010
          • 5

          #5
          So simple. I did not have VBA content enabled. I have not used access since Access 97 was out. Now I see results and debug is talking to me. Thanks for your suggestions. -Al.

          Comment

          Working...