Lock a field only for that record- Need some help !

S

sunilkeswani

Hi,

I have a form which is something like this. There are 3 command
buttons, which input Now() into their corresponding text boxes. I want
the data to become uneditable once the command button is pressed.

EXAMPLE

We try 3 times before closing a pending issue. There are 3 buttons with
text boxes
ATTEMPT 1, ATTEMPT 2, & ATTEMPT 3

Now, there needs to be a validation that Attmept 1 time should always
be before attempt 2 and 3...Also, once the Attempt 1 is registered, the
particular entry should become uneditable.

I tried locking the field, but it remains locked even when i go to the
next record on the form...

Please help

Regards
Sunil
 
A

Al Camp

Sunil,
Given that Date Attempt 1thru 3 are all Null until updated, use the Click
event of each button with this code...
Attempt1 = Date()
Attemp1.Enabled = False
Do this for each button and associated field.

You'll also need this code for the OnCurrent Event of the form itself...
Attemp1.Enabled = IsNull(Attempt1)
Attemp2.Enabled = IsNull(Attempt2)
Attemp3.Enabled = IsNull(Attempt3)
 
S

sunilkeswani

Thanks. this works like I wanted, but the only problem is that the
command button is still enabled, and when clicked again, the field
still gets updated with the new Date ().

Can you please advise on how i can make that field on this particular
record uneditable?

Regards
Sunil
 
A

Al Camp

Disable the button After clicking, and OnCurrent too.
Attempt1 = Date()
Attemp1.Enabled = False
btnAttempt1.Enabled = False
Do this for each button and associated field.

You'll also need this code for the OnCurrent Event of the form itself...
Attemp1.Enabled = IsNull(Attempt1)
btnAttempt1.Enabled = IsNull(Attempt1)
Attemp2.Enabled = IsNull(Attempt2)
btnAttempt1.Enabled = IsNull(Attempt2)
Attemp3.Enabled = IsNull(Attempt3)
btnAttempt1.Enabled = IsNull(Attempt3)

Actually, if you set Attempt1 thru Attempt3 as Disabled = False in design
mode, then you would only have to handle Updating the fields, and Disabling
the buttons. The fields would always be disasbled... whether Null or Not.
 

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