Object Error

D

Doug_C

Hi,

Could anyone tell me what this means?

Error Number 438, Object doesn't support this property or method.

I have a database and was copying some code and fields from tables and
forms. If my user name is in the User table the form will open with no
problem but if I delete my name out of the table(which should be as if anyone
opened the database without permissions then it would be read only.) I get
the above error.

Not a biggy, I can remove it all but I just want to know what this error
represents so I may fix it but also for learning purposes as well.

Thanks!
 
S

Stefan Hoffmann

hi Doug,

Doug_C said:
Could anyone tell me what this means?
Error Number 438, Object doesn't support this property or method.
Yup. The used property is not available.
I have a database and was copying some code and fields from tables and
forms. If my user name is in the User table the form will open with no
problem but if I delete my name out of the table(which should be as if anyone
opened the database without permissions then it would be read only.) I get
the above error.
How can we know without knowing your code?


mfG
--> stefan <--
 
D

Doug_C

That's the problem, which part do you need to see? All the code in the form
is a little lengthy.
 
S

Stefan Hoffmann

hi Doug,

Doug_C said:
That's the problem, which part do you need to see? All the code in the form
is a little lengthy.
Form_Open, Form_Load and Form_Current may be sufficent.


mfG
--> stefan <--
 
D

Doug_C

Hello,

This is in the OnLoad:

Private Sub Form_Load()
DoCmd.Restore
Call CheckPermissions
End Sub

Following that, I have:

Private Sub CheckPermissions()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim txtUser As String
Dim stSql As String
Dim stPermissions As String


On Error GoTo eh

txtUser = basMain.sGetUser
Set db = CurrentDb

stSql = "SELECT tblPermissions.Description, tblUsers.LogonID FROM
tblPermissions"
stSql = stSql & " INNER JOIN tblUsers ON tblPermissions.Level =
tblUsers.PermisLevel"
stSql = stSql & " WHERE tblUsers.LogonID=" & "'" & txtUser & "'"

Set rs = db.OpenRecordset(stSql)

If Not rs.EOF Then
stPermissions = rs!Description
Select Case stPermissions
Case "Admin"
AllowAdditions = True
AllowEdits = True
AllowDeletions = True
Case "PowerUser"
AllowAdditions = True
AllowEdits = False
AllowDeletions = False
Case Else
'''Me.RecordsetType = 2
Call DisableControls
End Select
Else
' User is not a part of the tblUsers table
Call DisableControls
End If

rs.Close
Set rs = Nothing
db.Close
Set db = Nothing

Exit Sub
eh:
MsgBox "Error Number " & Err.Number & " " & Err.Description,
vbInformation, "Error"
End Sub

Private Sub DisableControls()
Dim ctl As Control

For Each ctl In Me.Controls
If Not TypeOf ctl Is Label And _
Not TypeOf ctl Is CommandButton Then
ctl.Locked = True
End If
If TypeOf ctl Is CommandButton Then
If ctl.Name = "cmdAddRecord" Then
ctl.Enabled = False
End If
End If
Next ctl
End Sub


The is nothing in the Open or Current. I set the form up exactly as the one
I copied the code from. If my user name is in the table, I don't get the
error but if I take my name out, that's when I get the error.

Thank you!!
 
D

Doug_C

I figured it out. I have a small picture on the form made in Photoshop. When
I removed it, I don't get the error anymore. Funny, if I leave the picture on
the form but have my user name in the table, I don't get the error.

Thank you anyway for all of your help and time that you have put in to
assisting me.
 
Top