Hello again,
I am trying to hide duplicate fields in a continues form (like it does in reports) but could not find a proper way to do this so I figured I'd code it in.
I created an unbound [tbVakfilter] which is empty, then run a loop that checks the field [tbVakcode] against it and if it is the same it should hide the field. At first I got an error regarding focus so I made sure it switched focus and then hides the field.
The problem is that setting the field to visible or not changes it for all entries. So my question is does someone know what I could do to fix this or maybe even know a better way to handle this?
I am trying to hide duplicate fields in a continues form (like it does in reports) but could not find a proper way to do this so I figured I'd code it in.
I created an unbound [tbVakfilter] which is empty, then run a loop that checks the field [tbVakcode] against it and if it is the same it should hide the field. At first I got an error regarding focus so I made sure it switched focus and then hides the field.
The problem is that setting the field to visible or not changes it for all entries. So my question is does someone know what I could do to fix this or maybe even know a better way to handle this?
Code:
Private Sub Form_Load()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb
Set rst = Me.Recordset
If rst.EOF = True Then Exit Sub
rst.MoveFirst
Do While rst.EOF = False
If Me.tbVakfilter = Me.tbVakcode Then
Me.tbToetscode.SetFocus
Me.tbVakcode.Visible = False
Else
Me.tbToetscode.SetFocus
Me.tbVakcode.Visible = True
Me.tbVakfilter = Me.tbVakcode
End If
rst.MoveNext
Loop
Set rst = Nothing
Set db = Nothing
End Sub
Last edited: