473,387 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

way to LOCK a textbox after data goes in

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)

Jun 7 '07 #1
4 6224
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...@yahoo.comwrote:
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)

Jun 7 '07 #2

"James" <ja******************@yahoo.co.ukwrote in message
news:11**********************@p47g2000hsd.googlegr oups.com...
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...@yahoo.comwrote:
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.
Jun 7 '07 #3
On Jun 7, 11:36 am, "paii, Ron" <p...@pack.comwrote:
"James" <james_no_spam_ple...@yahoo.co.ukwrote in message

news:11**********************@p47g2000hsd.googlegr oups.com...
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...@yahoo.comwrote:
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

Jun 7 '07 #4
In article <11**********************@p47g2000hsd.googlegroups .com>,
ca***************@yahoo.com says...
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)


Shouldnt ever have to have it 'unlocked' if its populated by a button
click. Click the button and set the field value by code. End of story.
never give the user the right to directly enter data in the text box to
begin with.
Jun 13 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: John Bailo | last post by:
I'm seeing some odd locking behavior when using an DB2400 database and running an ado.net transaction. My code -- in simplified form, appears at the bottom. I want to run several INSERT...
0
by: John Bailo | last post by:
I'm seeing some odd locking behavior when using an DB2400 database and running an ado.net transaction. My code -- in simplified form, appears at the bottom. I want to run several INSERT...
16
by: Adda | last post by:
If I cycle through the MdiChildActivate event of the parent form I can read text in a textbox on the child mdiform -- console.writeline(Me.ActiveMdiChild.Controls(1).Text) But if I have a sub...
1
by: cyningeston | last post by:
OS: WinXP Pro, VB/ASP/ADO.NET I'm building a web-based supplier management application. For each supplier we are required by the FDA to track certain documents. I've managed to pull them from...
10
by: moondaddy | last post by:
I have a textbox on a webform and based on certain conditions I wanted to prevent a user from editing its text. I dont like the look of the texbox when its disabled and was wondering if there is a...
9
daoxx
by: daoxx | last post by:
Hi Question#1 Is it possible to show a textbox (linked to a field) when the mouse pointer goes over a checkbox, and hiding it when the pointer goes away, and at the same time allowing the user to...
25
by: zmickle | last post by:
Excuse my noobness. I am managing an access database that is shared by 4 users. Management does not want to use any technologies outside of access for this application (no SQL Server, etc). I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.