method or data member not found

sandy6078

Take a deep breath
Local time
Today, 14:24
Joined
Jul 17, 2007
Messages
135
I have the following code in the open event
Code:
If User.AccessID = 1 Then
      Me.cmdAdmin.Enabled = True
   Else
      Me.cmdAdmin.Enabled = False
End If

I get the error "Method or data member not found" when the form opens. I would very much appreciate some insight.
 
It would be this line causing you problems:

If User.AccessID = 1 Then

Unless you have created your own TYPE you don't reference AccessID this way. Is AccessID a part of the recordset of the form? If so then it would likely be

If Me!AccessID = 1 Then
 
I have a this code along with several others and modules was orignially from a security access database created by richard rensel. The User is from this module.
Code:
Public Type UserInfo
ViewID As Integer
AccessID As Integer
Active As Boolean
Password As String
UserID As String
SecurityID As String
End Type

Public User As UserInfo

The code works in his database but when I adapted it to my database I get the error. I am using access 2007 if that makes a difference.
 
Something that I noticed; when I deleted and retyped the code, after typing
me.
I was able to capture "cmdAdmin" from the drop down box,
but after the next
"."
the drop down box did not include "Enabled".
 
There is more to that code than you've shown here and it is important to solving this to see the rest. The type can't populate itself, something is populating those values and then you can access those values but it isn't clear from your post as to how to get to them.
 
Well, I was going to type yes cmdAdmin is a command button because I just assumed it was. Lightbulb went off and checked first. It is not, I was so caught up in trying to figure out why the code was not working that I did not check the obvious. No it was not a command button it was a label. Makes me feel like a big goof. Thank you Bob for asking the right question. I really appreciate all the help I have gotten from this forum. By the way, I tested the code with a command button and of course it works perfectly :o
 
Yeah, since a label doesn't have an .Enabled property that was why I asked that quesiton. Glad you got it sorted, and don't feel too embarassed - I've done things similar in the past myself.
 

Users who are viewing this thread

Back
Top Bottom