I am having this strange problem.
I have secured one of my forms. Users have to enter their userid and password. Once their userid is authenticated it is stored in a table. On my form I have the userid field. I use the code below to see if userid matches with the one in the table. If it does they can edit their records and if it doesn't they cannot. The problem is that if the userid matches it lets the users edit the fields on the mainform but it locks the subform. My form has 3 subforms on it and it is locking all 3 of them. I checked the subform properties and it is not locked. I tried adding this line of code but doesn't work.
Me.Milestone_subform.Enabled = True
Any ideas what might be the reason for this.
Here is my code which checks for userid
Private Sub Form_Current()
'Build SQL String from creating recordset to determine if
'the current record is from the current user
SQL = "SELECT UserName, UserLevel FROM tblBusinessOppurtunity_Main " & _
"INNER JOIN N_tblLocalUser ON tblBusinessOppurtunity_Main.UserName = N_tblLocalUser.UID " & _
"WHERE (Opportunity_ID = " & Me.Opportunity_ID & " AND UserName = '" & LocalUser & "')"
objRec.Open SQL, CurrentProject.Connection, _
adOpenKeyset, adLockOptimistic, adCmdText
'If there is a match, allow the user to add, delete and edit records
If objRec.RecordCount = 1 Then
Me!UserName.Visible = False
Me.AllowAdditions = False
Me.AllowDeletions = True
Me.AllowEdits = True
Me!Combo48.Locked = True
Me!Business_Lead.Locked = True
Me.Milestone_subform.Enabled = True
'Else don't allow the user to add, delete and edit records
Else
Me.AllowAdditions = False
Me.AllowDeletions = False
Me.AllowEdits = False
End If
objRec.Close
End Sub
Thanx
Ekta