Lock one Control based on the value of another

reddevil1

Registered User.
Local time
Today, 09:02
Joined
Nov 12, 2012
Messages
92
I am trying to lock one Control based on the value of another. But my coding does not seem to work.

Any ideas on what I am doing wrong?

I put this coding in the After Update event but get "Syntax error"

=IIf([AmountReceived]<10000,[Commission Percent].[Locked]=True,[Commission Percent].[Locked]=False)
 
Try;
Code:
If Me.AmountReceived < 10000 Then
     Me.[Commission Percent].Locked = True
Else
     Me.[Commission Percent].Locked = False
End If
 
John BB,

Thanks very much, pal. It is much appreciated.

The coding works a treat. It is like i am now a fully fledged computer programmer (LOL).

I also experimented by removing the Me. and the coding still worked.
Is it necessary to have the Me. there. I ownder??
 
The coding works great.

But I have just noticed that if I close the database, and then open it again, the control is not locked.

It is only locked if I change it again?

Do i need some more coding in another place?
 
The Me. is tells VBA that it is looking for a Control/Object on the Current form.

I'm not sure what the implications of removing the Me. identifier are, but I'd leave it in myself :o
 
That's fantastic, JBJ.

It works a treat. Oh my database looks so coooool!!!

Thanks very much for your help.
 

Users who are viewing this thread

Back
Top Bottom