Hi Guys,
I want ot be able to trigger an event to occur after i enter a number into a
text box. For instance If i have a text box and I enetr a number into the
text box I want to activate the code wiothout pressing the enter key or by
moving the mouse. How would I do that??
I have already tried a few things to noavail. I have tried:
a. On Mouse Move
b. On Lost Focus
c. On Dirty
It is updated of course when you press the "enter" key, but I want the text
box to be updated as soon as a number button is pressed. ie without having to
press the "enter" key.
Any help would be much appreciated.
Cheers,
|
|
0
|
|
|
|
Reply
|
Utf
|
2/17/2010 10:56:01 PM |
|
On Wed, 17 Feb 2010 14:56:01 -0800, DontKnow
<DontKnow@discussions.microsoft.com> wrote:
>Hi Guys,
>
>I want ot be able to trigger an event to occur after i enter a number into a
>text box. For instance If i have a text box and I enetr a number into the
>text box I want to activate the code wiothout pressing the enter key or by
>moving the mouse. How would I do that??
>
>I have already tried a few things to noavail. I have tried:
>a. On Mouse Move
>b. On Lost Focus
>c. On Dirty
>
>It is updated of course when you press the "enter" key, but I want the text
>box to be updated as soon as a number button is pressed. ie without having to
>press the "enter" key.
>
>
>Any help would be much appreciated.
>
>Cheers,
so you want only one character in the field? The user will never enter a
number such as 10, or 312?
If so, you use the Change event of the control, which fires at every
keystroke. You will need to refer to the control's Text property rather than
the default Value property, because the Value is only set when Access knows
that you're done entering the number. E.g.
Private Sub txtYourTextbox_Change()
If Me!txtyourTextbox.Text = "1" Then ' the user typed 1
<do something with the user's input>
End Sub
--
John W. Vinson [MVP]
|
|
0
|
|
|
|
Reply
|
John
|
2/17/2010 11:37:18 PM
|
|
DontKnow wrote:
>I want ot be able to trigger an event to occur after i enter a number into a
>text box. For instance If i have a text box and I enetr a number into the
>text box I want to activate the code wiothout pressing the enter key or by
>moving the mouse. How would I do that??
>
>I have already tried a few things to noavail. I have tried:
>a. On Mouse Move
>b. On Lost Focus
>c. On Dirty
>
>It is updated of course when you press the "enter" key, but I want the text
>box to be updated as soon as a number button is pressed. ie without having to
>press the "enter" key.
>
If it's a single key stroke, use the Change event.
Otherwise provide more details about the "number".
--
Marsh
MVP [MS Access]
|
|
0
|
|
|
|
Reply
|
Marshall
|
2/18/2010 12:58:13 AM
|
|
Many thanks John for your input,
I still need to click on the form to enable access to see the new value that
I have entered. I was hoping to be able to have the form recognise as soon
as I input the number into the text box, and enable the code to be activated
the instant that I press the number into the text box. Is that possible?
cheers,
Cheers,
"John W. Vinson" wrote:
> On Wed, 17 Feb 2010 14:56:01 -0800, DontKnow
> <DontKnow@discussions.microsoft.com> wrote:
>
> >Hi Guys,
> >
> >I want ot be able to trigger an event to occur after i enter a number into a
> >text box. For instance If i have a text box and I enetr a number into the
> >text box I want to activate the code wiothout pressing the enter key or by
> >moving the mouse. How would I do that??
> >
> >I have already tried a few things to noavail. I have tried:
> >a. On Mouse Move
> >b. On Lost Focus
> >c. On Dirty
> >
> >It is updated of course when you press the "enter" key, but I want the text
> >box to be updated as soon as a number button is pressed. ie without having to
> >press the "enter" key.
> >
> >
> >Any help would be much appreciated.
> >
> >Cheers,
>
> so you want only one character in the field? The user will never enter a
> number such as 10, or 312?
>
> If so, you use the Change event of the control, which fires at every
> keystroke. You will need to refer to the control's Text property rather than
> the default Value property, because the Value is only set when Access knows
> that you're done entering the number. E.g.
>
> Private Sub txtYourTextbox_Change()
> If Me!txtyourTextbox.Text = "1" Then ' the user typed 1
> <do something with the user's input>
> End Sub
>
> --
>
> John W. Vinson [MVP]
> .
>
|
|
0
|
|
|
|
Reply
|
Utf
|
2/18/2010 12:59:01 AM
|
|
On Wed, 17 Feb 2010 16:59:01 -0800, DontKnow
<DontKnow@discussions.microsoft.com> wrote:
>
>Many thanks John for your input,
>
>I still need to click on the form to enable access to see the new value that
>I have entered. I was hoping to be able to have the form recognise as soon
>as I input the number into the text box, and enable the code to be activated
>the instant that I press the number into the text box. Is that possible?
Ummmm...
how is the user going to type anything into the textbox without selecting the
textbox, either with the mouse or by tabbing into it??????
The Change event will fire at the first keystroke (on any key) into the
control.
Could you explain just what result you want to happen, and what this number
is?
--
John W. Vinson [MVP]
|
|
0
|
|
|
|
Reply
|
John
|
2/18/2010 2:03:17 AM
|
|
Hi Guys,
here is my code:
Dim value As String
value = Me.Text3
Me.Text5 = "From" & " " & Format(Date, "dd-mmm-yyyy") & " " & "To" & " " &
Format(DateAdd("m", Me.Text3, Date), "dd-mmm-yyyy")
Me.Text5.Requery
Text5: is a text box that shows how many months ahead of todays date
Text 3 is the input number that you enter the number of months into.
The trouble that I have is that when I input a number into text box 3, the
number that is shown in the code at "value = Me.Text3" is the number that was
eneterd before. ie. if the number in the box is 5, and I enter another number
say 7, the code utilses/processes 5 and not 7??
Any help is appreciated!!
Cheers
"John W. Vinson" wrote:
> On Wed, 17 Feb 2010 16:59:01 -0800, DontKnow
> <DontKnow@discussions.microsoft.com> wrote:
>
> >
> >Many thanks John for your input,
> >
> >I still need to click on the form to enable access to see the new value that
> >I have entered. I was hoping to be able to have the form recognise as soon
> >as I input the number into the text box, and enable the code to be activated
> >the instant that I press the number into the text box. Is that possible?
>
> Ummmm...
>
> how is the user going to type anything into the textbox without selecting the
> textbox, either with the mouse or by tabbing into it??????
>
> The Change event will fire at the first keystroke (on any key) into the
> control.
>
> Could you explain just what result you want to happen, and what this number
> is?
>
> --
>
> John W. Vinson [MVP]
> .
>
|
|
0
|
|
|
|
Reply
|
Utf
|
2/18/2010 3:10:01 AM
|
|
Thanks Marshal Thats pretty much what John wrote!!
Can you read my reply to John please!!
Cheers,
"Marshall Barton" wrote:
> DontKnow wrote:
> >I want ot be able to trigger an event to occur after i enter a number into a
> >text box. For instance If i have a text box and I enetr a number into the
> >text box I want to activate the code wiothout pressing the enter key or by
> >moving the mouse. How would I do that??
> >
> >I have already tried a few things to noavail. I have tried:
> >a. On Mouse Move
> >b. On Lost Focus
> >c. On Dirty
> >
> >It is updated of course when you press the "enter" key, but I want the text
> >box to be updated as soon as a number button is pressed. ie without having to
> >press the "enter" key.
> >
>
> If it's a single key stroke, use the Change event.
> Otherwise provide more details about the "number".
>
> --
> Marsh
> MVP [MS Access]
> .
>
|
|
0
|
|
|
|
Reply
|
Utf
|
2/18/2010 3:15:01 AM
|
|
Hi,
Replace
value = Me.Text3
with
value = Me.Text3.Text
HTH,
Alex.
"DontKnow" wrote:
> Hi Guys,
>
> here is my code:
> Dim value As String
> value = Me.Text3
> Me.Text5 = "From" & " " & Format(Date, "dd-mmm-yyyy") & " " & "To" & " " &
> Format(DateAdd("m", Me.Text3, Date), "dd-mmm-yyyy")
> Me.Text5.Requery
>
> Text5: is a text box that shows how many months ahead of todays date
> Text 3 is the input number that you enter the number of months into.
>
> The trouble that I have is that when I input a number into text box 3, the
> number that is shown in the code at "value = Me.Text3" is the number that was
> eneterd before. ie. if the number in the box is 5, and I enter another number
> say 7, the code utilses/processes 5 and not 7??
>
> Any help is appreciated!!
>
> Cheers
>
>
>
>
> "John W. Vinson" wrote:
>
> > On Wed, 17 Feb 2010 16:59:01 -0800, DontKnow
> > <DontKnow@discussions.microsoft.com> wrote:
> >
> > >
> > >Many thanks John for your input,
> > >
> > >I still need to click on the form to enable access to see the new value that
> > >I have entered. I was hoping to be able to have the form recognise as soon
> > >as I input the number into the text box, and enable the code to be activated
> > >the instant that I press the number into the text box. Is that possible?
> >
> > Ummmm...
> >
> > how is the user going to type anything into the textbox without selecting the
> > textbox, either with the mouse or by tabbing into it??????
> >
> > The Change event will fire at the first keystroke (on any key) into the
> > control.
> >
> > Could you explain just what result you want to happen, and what this number
> > is?
> >
> > --
> >
> > John W. Vinson [MVP]
> > .
> >
|
|
0
|
|
|
|
Reply
|
Utf
|
2/18/2010 4:36:01 AM
|
|
Tokyo,
Your a genious, that actually works!! before I tried adding the ".Text" I
did not think it would work...
To my amazement it did!!
Many thanks,
"Tokyo Alex" wrote:
> Hi,
>
> Replace
> value = Me.Text3
> with
> value = Me.Text3.Text
>
> HTH,
> Alex.
>
> "DontKnow" wrote:
>
> > Hi Guys,
> >
> > here is my code:
> > Dim value As String
> > value = Me.Text3
> > Me.Text5 = "From" & " " & Format(Date, "dd-mmm-yyyy") & " " & "To" & " " &
> > Format(DateAdd("m", Me.Text3, Date), "dd-mmm-yyyy")
> > Me.Text5.Requery
> >
> > Text5: is a text box that shows how many months ahead of todays date
> > Text 3 is the input number that you enter the number of months into.
> >
> > The trouble that I have is that when I input a number into text box 3, the
> > number that is shown in the code at "value = Me.Text3" is the number that was
> > eneterd before. ie. if the number in the box is 5, and I enter another number
> > say 7, the code utilses/processes 5 and not 7??
> >
> > Any help is appreciated!!
> >
> > Cheers
> >
> >
> >
> >
> > "John W. Vinson" wrote:
> >
> > > On Wed, 17 Feb 2010 16:59:01 -0800, DontKnow
> > > <DontKnow@discussions.microsoft.com> wrote:
> > >
> > > >
> > > >Many thanks John for your input,
> > > >
> > > >I still need to click on the form to enable access to see the new value that
> > > >I have entered. I was hoping to be able to have the form recognise as soon
> > > >as I input the number into the text box, and enable the code to be activated
> > > >the instant that I press the number into the text box. Is that possible?
> > >
> > > Ummmm...
> > >
> > > how is the user going to type anything into the textbox without selecting the
> > > textbox, either with the mouse or by tabbing into it??????
> > >
> > > The Change event will fire at the first keystroke (on any key) into the
> > > control.
> > >
> > > Could you explain just what result you want to happen, and what this number
> > > is?
> > >
> > > --
> > >
> > > John W. Vinson [MVP]
> > > .
> > >
|
|
0
|
|
|
|
Reply
|
Utf
|
2/18/2010 4:46:06 AM
|
|
On Wed, 17 Feb 2010 20:46:06 -0800, DontKnow
<DontKnow@discussions.microsoft.com> wrote:
>Your a genious, that actually works!! before I tried adding the ".Text" I
>did not think it would work...
ummm... I *DID* say to use the .Text property. You didn't. That's why it
didn't work.
As written you can only use nine months or fewer; is that OK?
--
John W. Vinson [MVP]
|
|
0
|
|
|
|
Reply
|
John
|
2/18/2010 5:18:10 AM
|
|
Sorry John,
Yes you are correct, you did show me this...
Private Sub txtYourTextbox_Change()
If Me!txtyourTextbox.Text = "1" Then ' the user typed 1
Thanks for your input!!
Cheers,
"John W. Vinson" wrote:
> On Wed, 17 Feb 2010 20:46:06 -0800, DontKnow
> <DontKnow@discussions.microsoft.com> wrote:
>
> >Your a genious, that actually works!! before I tried adding the ".Text" I
> >did not think it would work...
>
> ummm... I *DID* say to use the .Text property. You didn't. That's why it
> didn't work.
>
> As written you can only use nine months or fewer; is that OK?
> --
>
> John W. Vinson [MVP]
> .
>
|
|
0
|
|
|
|
Reply
|
Utf
|
2/18/2010 6:01:01 AM
|
|
Ok. you're happy with using the Text property in the change
event, but you still need to guard against a user entering
weird things like ABC, 1234567, or whatever.
It seems like the minimum you need to do is make sure the
Text property can be converted to a month number:
Dim intMonthNum As Integer
If Not Me!txtyourTextbox.Text Like "*[!0-9]*" Then
intMonthNum = Val(Me!txtyourTextbox.Text)
If intMonthNum >= 1 And intMonthNum <= 12 Then
'user enterd a valid month number
Exit Sub
End If
End If
Beep
Me!txtyourTextbox.Text = ""
But, the code will run twice if the user enters 10, 11 or 12
so I really do not like this whole idea you are pursuing.
--
Marsh
MVP [MS Access]
|
|
0
|
|
|
|
Reply
|
Marshall
|
2/18/2010 3:00:59 PM
|
|
|
11 Replies
167 Views
(page loaded in 0.155 seconds)
Similiar Articles: Override Validation Rule - microsoft.public.access.forms ...> If a user tries to enter something other than "RESID" on the form, a message > box will ... The After Update event cannot be canceled ... in the form (say, a text box ... Date that does not update - microsoft.public.excel>> >I will be entering a number in cell A1 then pressing ... but the date comparison check does not trigger. ... I'm trying to program the Before Update Event for a text ... box ... VBA code to fax from Excel or Outlook - microsoft.public.windows ...... otherwise) runs in the background based on an event that triggers ... question: Do you *always* fax to the same number? ... - Enter a password for the new user, and then click ... tab stops.. moving to the next control using code... - microsoft ...I have a number of controls on my form ... Then in the textbox.enter event i sent the current control to be the next box. ... tab control form ... How can I trigger ... copy and paste text crashes word - microsoft.public.mac.office ...I doubt if your box is that old, but let's do the ... This triggers the Unix clean-up tasks that, among ... crash log > that I get from force-quitting after copying text ... insert into and repeating values - microsoft.public.access.queries ...... If LoanNo is text field then add single quote before and after the value CurrentDb ... Create a table Num with one number field N ... HOWTO: data table into acess accdb using ... Can't Use Microsoft Update - microsoft.public.windowsupdate ...... send me to the office web site and it doesn't trigger ... -----=_NextPart_000_0008_01CA8E2F.3B257C80 Content-Type: text ... 09:15:501 1132 d1c Report CWERReporter finishing event ... Ho wto trigger an event after entering a number in a text boxHi Guys, I want ot be able to trigger an event to occur after i enter a number into a text box. For instance If i have a text box and I enetr a number TextBoxBase.Clear MethodThe code within the event handler restricts data to numbers. After text ... text is not a valid number. Please re-enter") ' Clear the contents of the text box ... Onfocus event of text box - PHP HTML MySQL ASP articles tutorials ...Default value by using OnFocus event of a text box We can trigger any ... Default value by using OnFocus event of a text box ... Please enter the result of the sum as ... MS ACCESS :: How To Trigger Access Table Update Event... id in a number of ... I need to trigger an event for when a text box is ... to enter the panel result and append to that slide. I think I need after update event procedure ... html - Trigger a button click with JavaScript on the Enter key in ...How can I use JavaScript to trigger the button's click event when the Enter key is pressed inside the text box? There is already a different submit button on my current ... Ways to customize a text box - InfoPath - Office.comAfter you insert a text box on a form template, you can ... users about what data to enter into the text box ... For example, in a Number of nights in hotel text box ... Using JavaScript to prevent or trigger form submission when ENTER ...Using JavaScript to prevent or trigger form submission when ENTER is hit ... of submitting a form when hitting ENTER in a text input box. ... return !(window.event && window.event ... Order of events for database objects - Access - Office.comThe NotInList event occurs after you enter a value in a combo box that ... changes text in a text box, triggering a Change event ... on a query, Access triggers the Open event ... JQuery HowTo: Select text in input box on user select or focusSelect text in input box on user select or focus ... Labels: events, howto, html, jquery, reference, tip, workaround Understanding C# GUI Events - TechotopiaEach control has a number of events which can be triggered. For example, a text field can trigger an event when a ... Enter some text into the TextBox so that the Label ... 7/10/2012 10:11:06 AM
|