Continuous Subform Lock Field

  • Thread starter Thread starter Delaney
  • Start date Start date
D

Delaney

I have a continuous subform with an amount field and a
approved checked box. What I would like to do is lock the
amount field if approved = yes and it is a specific user.

This is what I have and it doesn't work

If Environ("Home") <> "UserName" And Me.Approved = 1 Then
Me.Amount.Locked = True
End If
 
Delaney said:
I have a continuous subform with an amount field and a
approved checked box. What I would like to do is lock the
amount field if approved = yes and it is a specific user.

This is what I have and it doesn't work

If Environ("Home") <> "UserName" And Me.Approved = 1 Then
Me.Amount.Locked = True
End If


Where did you place that code? It should be in the form's
Current event.

You said you wanted to check if Approved = yes, but you
compared it to 1. If Approved is a standard check box, then
you should check for True, which has a value of -1.
 
I tried it in the current, load, and open events.

I set Approved = 1 because it is a SQL Backend.
 
Got it. Even though ItemApproved is a bit field in the
Access code ItemApproved = True not ItemApproved = 1.
 
Delaney said:
I tried it in the current, load, and open events.

The Current event is the right one. Try planting a
breakpoint and double check the Environ value to make sure
it is the string "UserName" (shouldn't that be a variable or
function with the user's name???)

I set Approved = 1 because it is a SQL Backend.

OK
 
Back
Top