Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lock subform

Status
Not open for further replies.

Ielamrani

MIS
Jul 7, 2005
183
US
Can anyone tell me why this is not working?

If UCase(Text57) = UCase(Me.Combo66) Then
Me.frmForPhysicianRep.Locked = False


Else
Me.frmForPhysicianRep.Locked = True

End If
End Sub


I have a form(frmMain) with a subform (frmForPhysicianRep) in it.

If the value in text57 (Text57 is in login form) equal the value of combo66 (Combo66 is in frmMain) then subform is not locked else lock subform

Thanks
 
Drop the ME. and give it a try, if that does not work put a break point in there and see what your values are evaluating out to. It should work just fine.


Ascent
 
I dropped the Me. and the subform is alwyas locked. It should only be locked when text57 <> combo66

I am not sure what you mean by "put a break point in there...."
Thanks
 
In the code window toggle a breakpoint so that when the form loads, or the cmdbutton is pressed the code will stop there so you can verify your values for equality. It may be possible the values in the fields are not coming through correctly and need to be verified.

If this does not help let me know.

Ascent
 
I appreciate your help.
I did what you said but still no change.
Tried the following but the subform is always locked .
Private Sub Form_Load()

If UCase(txtUserName) = UCase(Me.Combo66) Then
frmForPhysicianRep.Locked = False

Else
frmForPhysicianRep.Locked = True

End If
End Sub

 
Could there be anything else in your code that could be causing the form to lock?

You might want to create a new form with a new subform on it and then create two command buttons, one to lock and the other to unlock and see if you get the same results. (This is what I did to test your code.

Just on the off chance you might try adding "form_" in front of the frmForPhysicianRep so that it looks like form_frmForPhysicianRep.Locked

Ascent
 
Yes, I added form_ and it worked. Thank you soooo much for you help and patience.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top