Disable fields /setfocus

popeye

Work smarter, not harder.
Local time
Today, 03:24
Joined
Aug 23, 2004
Messages
75
:) Ihave a form with a subform attached and also a enable form field and disable form fields button. the problem is that the disable form fields button refuses to work correctly. sometimes it disables everything on the main form and only one field on the subform. i get a messsage saying something about being unable to lock a field that has the focus.

The save button also has the lock records codes stored in it in the lost focus event.

How could i get around this.

I know that this may just be one more/less line of code. could someone help.
 
i get a messsage saying something about being unable to lock a field that has the focus.

well as per your statement that sometimes it gives you a message that a field cannot be locked when it has a focus. so allyou have to do is to have the focus on your command button before theevent works. if yiou are trying to lock a field when it has focus or lets say a subform when any of its fields had focus then it will not lock.
 
thanks for the reply.

i dont get the "cant lock field that has focus" message now so thanks. but the problem now is that only one of the fields in the subform is locking the others dont.

this is the code behind the lock button/

Private sub cmd_lock_click()
on error goto err_cmd_lock_click

me.cmd_lock.setfocus

me.Benefactors_subform.form!surname.enabled=true
me.benefactors_subform.form!christianname.enabled=true


and there are some other fields with other field names.

I cant seem to understand why the surna,e field is locking but the others arent./
Any ideas? :confused:
 
check in the surname fiedl properties if the
enabled = no
locaked = yes
it might be the reason you are getting this message
 
GREAT PROGRESS, last prob

all of the fields both in the form and the subformn are locking now.

i created another textbox that is unbound and set the focus in the codes behind the onclck event.

I want to set the focus to it, which i have been able to do so that the other records can close but i want a line of code to automatically remove the focus from it. Not neceesarily to place the focus anywhere else.

Thanks for the quick replies. could u help with this. :cool:
 
send it to your hotmail?

do you mean i should send you a copy of the datatbase through to your hotmail address.


Im gona send it through in a sec.

Its. 13 mb.
 
popeye,

Don't know if Hotmail "wants" 13 MB.

Remove graphics & unneeded stuff
Tools --> Database Utilities --> Compact/Repair
Then ZIP

Should get MUCH smaller than 13 MB!

Wayne
 
Sent you the db

i sent oit to your mail.
 
well i checked your DB and it is quite simple enought.

you created an unbound textbox so that it will have the focus and you can disable or enable the other textbox or control. you want to remove the focus from it and that will be done when you go for modification. as soon as the first field of your entry becomes enable move the focus to it. this coudl be done through you add record button.

me.fieldname.setfocus

put this at the last of your code before the error handler.

hope this helps u ....
 

Users who are viewing this thread

Back
Top Bottom