0

I am using MS Access 2016 and building a form to run a query that enables users to only extract columns that they need. I am planning on doing this with a checkbox for every column. How can I do this? I have tried the following but it does not work. It gives me a Compile Error: Method or data member not found.

Private Sub chk1_AfterUpdate()
  Me.column4.Visible = Nz(Me.chk1 = True, False)
End Sub

Private Sub Form_Current()
  Me.column4.Visible = Nz(Me.chk1 = True, False)
End Sub
1

2 Answers 2

1

You can hide a control but not a field. So try, where TextBox4 is bound to your column4:

Private Sub chk1_AfterUpdate()
    Me!TextBox4.Visible = Nz(Me!chk1.Value, False)
End Sub

Private Sub Form_Current()
    Me!TextBox4.Visible = Nz(Me!chk1.Value, False)
End Sub
Sign up to request clarification or add additional context in comments.

Comments

0
  Private Sub Check20_Click()
         If Me.Check20.Value = -1 Then
         Me.ID.Visible = False
         Else
         Me.ID.Visible = True
         End If
   End Sub

i will advise you to be careful placing any code under the form_current event, because it might be tricky to implement, this approach

1 Comment

Thank you but this code still gives me the same error: Method or data member not found

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.