Lock or disable form till cmdButton pressed

G

Guest

Hey,
I would like to lock out a subform until a button is clicked. This is a
data entry form based on a query. The button will disolve the lock/disable
for a single record's data entry. Once that record's data is entered, I would
like the form to re-lock/disable. It also has to be locked upon open and ...
oh yeah, it is on a tabcontrol. Hopefully this will not make the solution
anymore complex.

Thanks for your time,
Ghillie
 
G

Guest

In the button's click event, enter:

Me.Textbox1.Enabled=True
me.Textbox2.Enabled=False
etc.

I the form's AfterUpdate event, do the reverse:

Me.Textbox1.Enabled=true
etc.

HTH,
Barry
 
G

Guest

Thanks for your response. I may be interpreting this wrong, but why are you
alternating the True/False from textbox to textbox? Is it a typo.
 
G

Guest

Oops. Yes, it was a tyop.

Barry

ghillie5150 said:
Thanks for your response. I may be interpreting this wrong, but why are you
alternating the True/False from textbox to textbox? Is it a typo.
 
G

Guest

I'm getting run-time error 2164 "You can't disable a control while it has the
focus." It is referring to the afterupdate code that you had me put in.
Should I pre-empt this code with a setfocus?

Thanks
ghillie
 
G

Guest

Any suggestions where? I seem to have it working by setting focus
[beforeupdate] to the same command button. I guess the error is only
generated by having the cursor in a control holding data. Havent finished any
UAT on it. Do you forsee a problem?
 
G

Guest

Wait, now I'm confused. I thought you were disabling controls from the
command button's click event. If that's the case, the command button should
still have the focus. If you're disabling controls from one of the control's
own AfterUpdate events, you should set focus somewhere else that makes sense
to the user, like a command button. The choice of where to set focus is
purely a matter of usability.

Barry

ghillie5150 said:
Any suggestions where? I seem to have it working by setting focus
[beforeupdate] to the same command button. I guess the error is only
generated by having the cursor in a control holding data. Havent finished any
UAT on it. Do you forsee a problem?

Barry Gilbert said:
Yes, you'll need to set focus to another control first.

Barry
 
G

Guest

You are correct. Too many 'ritas on Cinco. I swapped it in order to enable
data entry via clicking the "Add button" or and existing record displayed in
a listbox. My bad. I forgot that I swapped them Friday. Thanks for the advise.

Barry Gilbert said:
Wait, now I'm confused. I thought you were disabling controls from the
command button's click event. If that's the case, the command button should
still have the focus. If you're disabling controls from one of the control's
own AfterUpdate events, you should set focus somewhere else that makes sense
to the user, like a command button. The choice of where to set focus is
purely a matter of usability.

Barry

ghillie5150 said:
Any suggestions where? I seem to have it working by setting focus
[beforeupdate] to the same command button. I guess the error is only
generated by having the cursor in a control holding data. Havent finished any
UAT on it. Do you forsee a problem?

Barry Gilbert said:
Yes, you'll need to set focus to another control first.

Barry

:

I'm getting run-time error 2164 "You can't disable a control while it has the
focus." It is referring to the afterupdate code that you had me put in.
Should I pre-empt this code with a setfocus?

Thanks
ghillie

:

Oops. Yes, it was a tyop.

Barry

:

Thanks for your response. I may be interpreting this wrong, but why are you
alternating the True/False from textbox to textbox? Is it a typo.

:

In the button's click event, enter:

Me.Textbox1.Enabled=True
me.Textbox2.Enabled=False
etc.

I the form's AfterUpdate event, do the reverse:

Me.Textbox1.Enabled=true
etc.

HTH,
Barry


:

Hey,
I would like to lock out a subform until a button is clicked. This is a
data entry form based on a query. The button will disolve the lock/disable
for a single record's data entry. Once that record's data is entered, I would
like the form to re-lock/disable. It also has to be locked upon open and ...
oh yeah, it is on a tabcontrol. Hopefully this will not make the solution
anymore complex.

Thanks for your time,
Ghillie
 

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