Continuous Subform Lock Field

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
 
M

Marshall Barton

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.
 
D

Delaney

I tried it in the current, load, and open events.

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

Delaney

Got it. Even though ItemApproved is a bit field in the
Access code ItemApproved = True not ItemApproved = 1.
 
M

Marshall Barton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top