V
vircalendar via AccessMonster.com
I have a subform containing a datasheet (and only a datasheet). When a user
selects a record on the subform and clicks an "edit" button on the main form,
data from the selected field is copied to an unbound textbox on the main form
to be edited. What I would like to do is simultaneously lock and disable the
datasheet so that, once a record has been selected, the user can't select
another record until his edit is done or cancelled.
The problem is that I can't get the focus off the datasheet, so I can't
disable it. I've tried the sequence
me.form.setfocus
me.txtbox.setfocus
but I still get the "can't disable a control that has the focus" error.
I know I could use a form view instead of a datasheet view, and add a 0 space
control that is given the focus, thus allowing me to disable and lock the
field in question, but using a form view interferes with some other things
I'm doing and I would rather not do that.
I've tried coming at the problem from the other direction, using the
onlostfocus and onexit events of the textbox to trigger some code, but the
problem there is that I haven't been able to figure out whether the event is
firing because the user clicked "accept" or "cancel" buttons (which would be
okay) or whether he went back the the subform (which would not be).
Isn't there some way to completely remove the focus from a datasheet subform?
selects a record on the subform and clicks an "edit" button on the main form,
data from the selected field is copied to an unbound textbox on the main form
to be edited. What I would like to do is simultaneously lock and disable the
datasheet so that, once a record has been selected, the user can't select
another record until his edit is done or cancelled.
The problem is that I can't get the focus off the datasheet, so I can't
disable it. I've tried the sequence
me.form.setfocus
me.txtbox.setfocus
but I still get the "can't disable a control that has the focus" error.
I know I could use a form view instead of a datasheet view, and add a 0 space
control that is given the focus, thus allowing me to disable and lock the
field in question, but using a form view interferes with some other things
I'm doing and I would rather not do that.
I've tried coming at the problem from the other direction, using the
onlostfocus and onexit events of the textbox to trigger some code, but the
problem there is that I haven't been able to figure out whether the event is
firing because the user clicked "accept" or "cancel" buttons (which would be
okay) or whether he went back the the subform (which would not be).
Isn't there some way to completely remove the focus from a datasheet subform?