Locking / Disabling one record (1 Viewer)

kirsty

Registered User.
Local time
Today, 02:14
Joined
Nov 5, 1999
Messages
19
Hi,

I want to add a message box (vbYesNo) and am unsure of the code to use. I want the message to read 'Are you sure you want to close this record?' and if Yes is clicked I want the current record to become either locked or all the controls disabled (but no other records) and if No is clicked just to return to the form.

Does anyone have any ideas?

Many thanks in advance,
Kirsty.
 

KDg

Registered User.
Local time
Today, 02:14
Joined
Oct 28, 1999
Messages
181
You need something along the lines of

dim MyRepsonse as variant

let myResponse=msgbox("Are you sure etc",vbyesno,"YOUR TITLE")
if myresponse=vbyes then
let me.controlname.enabled=false ( you can use Locked instead of Enabled here )
let ...cycle through all the controls you want to lock
end if

i found a good way of doing this was to have a check box on the end of the record line and place the code in the On_Click event checking for True/False state a the start

hope this helps

Drew
 

kirsty

Registered User.
Local time
Today, 02:14
Joined
Nov 5, 1999
Messages
19
Thanks for your help Drew.

I find that when I go to a new record the controls will still be disabled - I only want to enable the ones on the current record.

I.e. if I disable record 11 and close the database. When I go back I only want record 11 to be disabled - not all the others.

Do you know how to do this?

Thanks VERY much,

Kirsty.
 

TonTon

New member
Local time
Today, 02:14
Joined
Nov 2, 1999
Messages
9
You can use the OnCurrent event to set whether the current record's fields are locked/enabled.

When you click into a different record the OnCurrent event will run again.

Hope this helps; cheers
 

Users who are viewing this thread

Top Bottom