VB Code and subform problem

dcjones

Dereck
Local time
Today, 11:37
Joined
Mar 10, 2004
Messages
108
Hi all.

This is driving me mad, can you help.

I have a form which has a subform. The OnOpen event has the following code:

Private Sub Form_Open()
If User.lngUsrId = 1 Then

Me.Form.AllowAdditions = True
Me.Form.AllowDeletions = True
Me.Form.AllowEdits = True
Else
Me.Form.AllowAdditions = False
Me.Form.AllowDeletions = False
Me.Form.AllowEdits = False
End If

Exit_Form_Open:
Exit Sub


Err_Form_Open:
MsgBox Err.Number, Err.Description
Resume Exit_Form_Open

End Sub

When I login (using a good login name and password), if i go to the subform it is completly blank. If I remove the code the contents of the subform are there.

I have a table which holds the user information and the login name has an ID of 1.

Does anyone know what is going on.

Kind regards

Dereck
 
This is a guess...
Either
User.lngUsrId doesn't equal one.
Or
For some reason the filter on the form is making it return no records...


Vince
 
Private Sub Form_Open()
If User.lngUsrId = 1 Then

Me.Form.AllowAdditions = True
Me.Form.AllowDeletions = True
Me.Form.AllowEdits = True
Else
Me.Form.AllowAdditions = False
Me.Form.AllowDeletions = False
Me.Form.AllowEdits = False
End If
Me.MySubForm.Requery
 

Users who are viewing this thread

Back
Top Bottom