Re: way to LOCK a textbox after data goes in
- From: King Ron <KingRonPoindexter@xxxxxxxxx>
- Date: Thu, 07 Jun 2007 14:26:09 -0700
On Jun 7, 11:36 am, "paii, Ron" <p...@xxxxxxxx> wrote:
"James" <james_no_spam_ple...@xxxxxxxxxxx> wrote in message
news:1181228532.889142.260530@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi
You cannot change the visibility of something while it has the focus.
The fact you are clicking on btnEnd means it will have the focus,
instead add an extra line in your code to give something else the
focus such as:
Private Sub btnEnd_Click()
[Forms]![frmCustDetail]![frmTimeEntry]![txtCallEndTime] = Now()
SomeOtherControl.Setfocus
btnEnd.Visible = False
End Sub
Regards
James
On 7 Jun, 15:26, slinky <campbellbrian2...@xxxxxxxxx> wrote:
I have a textbox that a user enters the current time (in this case at
the end of a task, and it gets its value via a button's click event
and getting its value from =Now() ).
Is there a way to LOCK this textbox's value once the user hits the
button that posts the time. I tried to make the button invisibe right
after the button is hit, but I get an error.
Anyone got any clues for revision? Thanks! Here is my code:
Private Sub btnStart_Click()
[Forms]![frmCustDetail]![frmTimeEntry]![txtCallBeginTime] =
[Forms]![frmCustDetail]![frmTimeEntry]![txtNow]
End Sub
Private Sub btnEnd_Click()
[Forms]![frmCustDetail]![frmTimeEntry]![txtCallEndTime] = Now()
btnEnd.Visible = False
End Sub
(Note that the button for start gets its value from a textbox that
uses =Now(), and the End button simply gets a real =Now(). This all
works great up till the point that the user can change the end time by
hitting the End button again. My thoughts were to make it invisible
after hitting the button)
Assuming the button is no the same form as the text box, you can also
replace
[Forms]![frmCustDetail]![frmTimeEntry]![txtCallEndTime] = Now()
with
Me![txtCallEndTime] = Now()
Also add code to the OnCurrent event to show or hide the button depending on
the status of the text box.
....and if you still want to be able to be able to view the entered
value after it's been set, toggle the .Locked property instead instead
of the .Visible property:
If (Len(Me![txtCallEndTime]) > 0) then
Me.txtCallEndTime.Locked = True
Else
Me.txtCallEndTime.Locked = False
End If
Lucks!
Ron, King of Chi
.
- References:
- way to LOCK a textbox after data goes in
- From: slinky
- Re: way to LOCK a textbox after data goes in
- From: James
- Re: way to LOCK a textbox after data goes in
- From: paii, Ron
- way to LOCK a textbox after data goes in
- Prev by Date: Re: Trying to set up a query
- Next by Date: Re: Stephen Lebans Snapshot to PDF solution
- Previous by thread: Re: way to LOCK a textbox after data goes in
- Next by thread: Re: way to LOCK a textbox after data goes in
- Index(es):
Relevant Pages
|