Results 1 to 2 of 2
  1. #1
    daywalker0086 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2014
    Posts
    9

    Arrow use a variable to approach fields in a report

    Hi everybody,
    I have a little problem:
    Following situation:
    Code:
    Private Sub Detailbereich_Format(Cancel As Integer, FormatCount As Integer)
    Dim step As Integer
    Dim i As Integer
    i = 4
    step = 396
    Me!Wert7.Visible = Not Nz(Me.Feld19, "") = ""
    Me!Wert7.Visible = Not Nz(Me.Feld21, "") = ""
    Me!Wert6.Visible = Not Nz(Me.Feld16, "") = ""
    Me!Wert5.Visible = Not Nz(Me.Feld13, "") = ""
    Me!Wert3.Visible = Not Nz(Me.Feld7, "") = ""
    
    Me!Wert4.Visible = Not Nz(Me.Feld10, "") = ""
    
    Me!Wert2.Visible = Not Nz(Me.Feld4, "") = ""
    Me!Wert1.Visible = Not Nz(Me.Feld1, "") = ""
    Me!Wert1.Visible = Not Nz(Me.Feld2, "") = ""
    Me!Wert1.Visible = Not Nz(Me.Feld3, "") = ""
    If Me.Wert1.Visible = False Then
    
    Me.Feld4.Top = 170
    Me.Feld5.Top = 170
    Me.Feld6.Top = 170
    Else
    Me.Wert2.Top = 566
    Me.Feld4.Top = 566
    Me.Feld5.Top = 566
    Me.Feld6.Top = 566
    End If
    what I want:
    Code:
    Private Sub Detailbereich_Format(Cancel As Integer, FormatCount As Integer)
    Dim step As Integer
    Dim i As Integer
    i = 4
    step = 396
    Me!Wert7.Visible = Not Nz(Me.Feld19, "") = ""
    Me!Wert7.Visible = Not Nz(Me.Feld21, "") = ""
    Me!Wert6.Visible = Not Nz(Me.Feld16, "") = ""
    Me!Wert5.Visible = Not Nz(Me.Feld13, "") = ""
    Me!Wert3.Visible = Not Nz(Me.Feld7, "") = ""
    
    Me!Wert4.Visible = Not Nz(Me.Feld10, "") = ""
    
    Me!Wert2.Visible = Not Nz(Me.Feld4, "") = ""
    Me!Wert1.Visible = Not Nz(Me.Feld1, "") = ""
    Me!Wert1.Visible = Not Nz(Me.Feld2, "") = ""
    Me!Wert1.Visible = Not Nz(Me.Feld3, "") = ""
    If Me.Wert1.Visible = False Then
       for i = 4 to 7 Step 3
        Me.Feld(i).Top = 170
        Me.Feld(i+1).Top = 170
        Me.Feld(i+2).Top = 170
       Next
    Else
    Me.Wert2.Top = 566
    Me.Feld4.Top = 566
    Me.Feld5.Top = 566
    Me.Feld6.Top = 566
    End If
    Is it is possible to use a variable to specify fields?

  2. #2
    pbaldy's Avatar
    pbaldy is online now Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try

    Me("Feld" & i).Top
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Referencing form fields with a string variable
    By ts_hunter in forum Programming
    Replies: 3
    Last Post: 02-13-2014, 01:06 PM
  2. Replies: 6
    Last Post: 03-13-2013, 03:03 PM
  3. Replies: 5
    Last Post: 02-21-2013, 10:03 PM
  4. Replies: 1
    Last Post: 08-27-2012, 12:33 PM
  5. Report with variable name
    By KickPuncher in forum Reports
    Replies: 13
    Last Post: 12-30-2010, 11:04 AM

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