Hiding a field in Access 2000 using "Code Builder"

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi I hope someone can help

Im am trying to hide a field on a Access Form, but assign a command button
to make the field visible so that when i click on the command button I am
asked for a password .

This is the what I am trying to use but its not working

Private Sub Command135_Click()
Sub hide()
Dim Password As String
Dim ans As String
Password = "******"
ans = InputBox("Enter Password")
If ans = Password Then
Documents.Visible = True
Else
Documents.Visible = False
End If

End Sub


can someone tell me where i am going wrong
 
OK
Whet this line doing in the code
Sub hide()
============================
I tried your code and it works, when you say it doesn't work what do you mean?
 
Ofer,

what should happen is I should get a input box pop up when i click on the
command button "Command135" which then ask for a password and if the password
is correct then a field called "Documents" then becomes visible for data entry

But nothing is happening


Jet
 
You still didnt answer my question about what this line doing in your code,
it looks like you copied this code to the form.
Open the form in design view, look at the on click event of the button,
select code view, then enter tis code into it

Dim Password As String
Dim ans As String
Password = "******"
ans = InputBox("Enter Password")
If ans = Password Then
Documents.Visible = True
Else
Documents.Visible = False
End If
 
You still didnt answer my question about what this line doing in your code,
it looks like you copied this code to the form.
Open the form in design view, look at the on click event of the button,
select code view, then enter tis code into it

Dim Password As String
Dim ans As String
Password = "******"
ans = InputBox("Enter Password")
If ans = Password Then
Documents.Visible = True
Else
Documents.Visible = False
End If
 
"=?Utf-8?B?SmV0IG5lZWRzIHlvdXIgaGVscA==?=" <Jet needs your
(e-mail address removed)> wrote in (e-mail address removed):
If ans = Password Then
Documents.Visible = True
Else
Documents.Visible = False
End If

"Documents" is the name of a collection and doesn't have a Visible
property. If you want to access a control on your form, you have to be
explicit:-

Me.Controls("Documents").Visible = True

or abbreviated

Me!Documents.Visible = True

but I would think about giving the control a less contentious name.

Hope that helps


Tim F
 
Back
Top