Update the value in a textbox 
Author Message
 Update the value in a textbox

I have a on change event in a textbox. Basically,
everytime a user changes the value, I want to do string
comparison. For example,

If [My textbox].Value = "Hallo" Then
  Msgbox("Hallo My Friend")
End If

However, I don't think it's updated yet. So, if the
previous value is "Hal" and I put "lo", it still thinks
that "Hal" is the value until I change focus to a
different object. Does anyone know how to overcome this
problem ?

Thanks



Sun, 20 Nov 2005 05:19:45 GMT  
 Update the value in a textbox
Try using the AfterUpdate event of the textbox to run the code.

--
       Ken Snell
<MS ACCESS MVP>


Quote:

> I have a on change event in a textbox. Basically,
> everytime a user changes the value, I want to do string
> comparison. For example,

> If [My textbox].Value = "Hallo" Then
>   Msgbox("Hallo My Friend")
> End If

> However, I don't think it's updated yet. So, if the
> previous value is "Hal" and I put "lo", it still thinks
> that "Hal" is the value until I change focus to a
> different object. Does anyone know how to overcome this
> problem ?

> Thanks



Sun, 20 Nov 2005 07:09:15 GMT  
 Update the value in a textbox

Thanks. However, after update is only trigered when the
focus has moved to another object, while I want is, after
finishing typing one character, it's trigered, that's why
I use on change.

Quote:
>-----Original Message-----
>Try using the AfterUpdate event of the textbox to run the
code.

>--
>       Ken Snell
><MS ACCESS MVP>



>> I have a on change event in a textbox. Basically,
>> everytime a user changes the value, I want to do string
>> comparison. For example,

>> If [My textbox].Value = "Hallo" Then
>>   Msgbox("Hallo My Friend")
>> End If

>> However, I don't think it's updated yet. So, if the
>> previous value is "Hal" and I put "lo", it still thinks
>> that "Hal" is the value until I change focus to a
>> different object. Does anyone know how to overcome this
>> problem ?

>> Thanks

>.



Sun, 20 Nov 2005 08:30:19 GMT  
 Update the value in a textbox
The problem is that the code then runs after each character is typed in. So
it runs many times until you're done typing your entry.

But, if that is what you want to do, then use the .Text property of the
textbox, not the .Value:

If [My textbox].Text = "Hallo" Then
    Msgbox("Hallo My Friend")
End If

--
       Ken Snell
<MS ACCESS MVP>


Quote:

> Thanks. However, after update is only trigered when the
> focus has moved to another object, while I want is, after
> finishing typing one character, it's trigered, that's why
> I use on change.

> >-----Original Message-----
> >Try using the AfterUpdate event of the textbox to run the
> code.

> >--
> >       Ken Snell
> ><MS ACCESS MVP>



> >> I have a on change event in a textbox. Basically,
> >> everytime a user changes the value, I want to do string
> >> comparison. For example,

> >> If [My textbox].Value = "Hallo" Then
> >>   Msgbox("Hallo My Friend")
> >> End If

> >> However, I don't think it's updated yet. So, if the
> >> previous value is "Hal" and I put "lo", it still thinks
> >> that "Hal" is the value until I change focus to a
> >> different object. Does anyone know how to overcome this
> >> problem ?

> >> Thanks

> >.



Sun, 20 Nov 2005 09:49:55 GMT  
 Update the value in a textbox
Ken

Why is it a problem to run code in the change event ?

cheers

Andrew

--
****************************************************************************
andrewbingham.com

tel        01223 514674 (Cambridge)
mobile  07970 161057
fax        07970 601283

DISCLAIMER, PLEASE NOTE:
This communication is for the attention of the named recipient only
The content should not be passed on to any other person.
It is sent in good faith, in confidence, and without legal responsibility.

VIRUS CHECK
Emails and attachments are virus checked using Norton? AntiVirus?
2002 which is regularly updated. However  it remains the recipients
responsibility to check emails and attachments sent, or forwarded,
from andrewbingham.com for viruses and macro viruses
****************************************************************************

Quote:
> The problem is that the code then runs after each character is typed in.
So
> it runs many times until you're done typing your entry.

> But, if that is what you want to do, then use the .Text property of the
> textbox, not the .Value:

> If [My textbox].Text = "Hallo" Then
>     Msgbox("Hallo My Friend")
> End If

> --
>        Ken Snell
> <MS ACCESS MVP>



> > Thanks. However, after update is only trigered when the
> > focus has moved to another object, while I want is, after
> > finishing typing one character, it's trigered, that's why
> > I use on change.

> > >-----Original Message-----
> > >Try using the AfterUpdate event of the textbox to run the
> > code.

> > >--
> > >       Ken Snell
> > ><MS ACCESS MVP>



> > >> I have a on change event in a textbox. Basically,
> > >> everytime a user changes the value, I want to do string
> > >> comparison. For example,

> > >> If [My textbox].Value = "Hallo" Then
> > >>   Msgbox("Hallo My Friend")
> > >> End If

> > >> However, I don't think it's updated yet. So, if the
> > >> previous value is "Hal" and I put "lo", it still thinks
> > >> that "Hal" is the value until I change focus to a
> > >> different object. Does anyone know how to overcome this
> > >> problem ?

> > >> Thanks

> > >.



Sun, 20 Nov 2005 21:18:45 GMT  
 Update the value in a textbox

Thanks a lot, I think it works now, it gives me the
updated one when I test it using MsgBox. One thing I am
confused though, why when I use .Value, it does not give
me the updated one ?

Quote:
>-----Original Message-----
>The problem is that the code then runs after each

character is typed in. So
Quote:
>it runs many times until you're done typing your entry.

>But, if that is what you want to do, then use the .Text
property of the
>textbox, not the .Value:

>If [My textbox].Text = "Hallo" Then
>    Msgbox("Hallo My Friend")
>End If

>--
>       Ken Snell
><MS ACCESS MVP>



>> Thanks. However, after update is only trigered when the
>> focus has moved to another object, while I want is,
after
>> finishing typing one character, it's trigered, that's
why
>> I use on change.

>> >-----Original Message-----
>> >Try using the AfterUpdate event of the textbox to run
the
>> code.

>> >--
>> >       Ken Snell
>> ><MS ACCESS MVP>



>> >> I have a on change event in a textbox. Basically,
>> >> everytime a user changes the value, I want to do
string
>> >> comparison. For example,

>> >> If [My textbox].Value = "Hallo" Then
>> >>   Msgbox("Hallo My Friend")
>> >> End If

>> >> However, I don't think it's updated yet. So, if the
>> >> previous value is "Hal" and I put "lo", it still
thinks
>> >> that "Hal" is the value until I change focus to a
>> >> different object. Does anyone know how to overcome
this
>> >> problem ?

>> >> Thanks

>> >.

>.



Mon, 21 Nov 2005 04:27:04 GMT  
 Update the value in a textbox
When I was reading the post, it appeared that he wanted to compare a
completed string, which the control doesn't have until the control's value
is updated. I was commenting on how the Change event would look at the
control after each character, not recognizing at that point that apparently
he wanted to do something once the "magic" word string had been reached.

--
       Ken Snell
<MS ACCESS MVP>


Quote:
> Ken

> Why is it a problem to run code in the change event ?

> cheers

> Andrew

> --

****************************************************************************
Quote:
> andrewbingham.com

> tel        01223 514674 (Cambridge)
> mobile  07970 161057
> fax        07970 601283

> DISCLAIMER, PLEASE NOTE:
> This communication is for the attention of the named recipient only
> The content should not be passed on to any other person.
> It is sent in good faith, in confidence, and without legal responsibility.

> VIRUS CHECK
> Emails and attachments are virus checked using Norton? AntiVirus?
> 2002 which is regularly updated. However  it remains the recipients
> responsibility to check emails and attachments sent, or forwarded,
> from andrewbingham.com for viruses and macro viruses

****************************************************************************

- Show quoted text -

Quote:


> > The problem is that the code then runs after each character is typed in.
> So
> > it runs many times until you're done typing your entry.

> > But, if that is what you want to do, then use the .Text property of the
> > textbox, not the .Value:

> > If [My textbox].Text = "Hallo" Then
> >     Msgbox("Hallo My Friend")
> > End If

> > --
> >        Ken Snell
> > <MS ACCESS MVP>



> > > Thanks. However, after update is only trigered when the
> > > focus has moved to another object, while I want is, after
> > > finishing typing one character, it's trigered, that's why
> > > I use on change.

> > > >-----Original Message-----
> > > >Try using the AfterUpdate event of the textbox to run the
> > > code.

> > > >--
> > > >       Ken Snell
> > > ><MS ACCESS MVP>



> > > >> I have a on change event in a textbox. Basically,
> > > >> everytime a user changes the value, I want to do string
> > > >> comparison. For example,

> > > >> If [My textbox].Value = "Hallo" Then
> > > >>   Msgbox("Hallo My Friend")
> > > >> End If

> > > >> However, I don't think it's updated yet. So, if the
> > > >> previous value is "Hal" and I put "lo", it still thinks
> > > >> that "Hal" is the value until I change focus to a
> > > >> different object. Does anyone know how to overcome this
> > > >> problem ?

> > > >> Thanks

> > > >.



Mon, 21 Nov 2005 08:01:25 GMT  
 Update the value in a textbox
.Value doesn't have a value until the control has either been updated with a
new entry (it was Null before) or the control is bound to a field that does
have a value.

--
       Ken Snell
<MS ACCESS MVP>


Quote:

> Thanks a lot, I think it works now, it gives me the
> updated one when I test it using MsgBox. One thing I am
> confused though, why when I use .Value, it does not give
> me the updated one ?

> >-----Original Message-----
> >The problem is that the code then runs after each
> character is typed in. So
> >it runs many times until you're done typing your entry.

> >But, if that is what you want to do, then use the .Text
> property of the
> >textbox, not the .Value:

> >If [My textbox].Text = "Hallo" Then
> >    Msgbox("Hallo My Friend")
> >End If

> >--
> >       Ken Snell
> ><MS ACCESS MVP>



> >> Thanks. However, after update is only trigered when the
> >> focus has moved to another object, while I want is,
> after
> >> finishing typing one character, it's trigered, that's
> why
> >> I use on change.

> >> >-----Original Message-----
> >> >Try using the AfterUpdate event of the textbox to run
> the
> >> code.

> >> >--
> >> >       Ken Snell
> >> ><MS ACCESS MVP>



> >> >> I have a on change event in a textbox. Basically,
> >> >> everytime a user changes the value, I want to do
> string
> >> >> comparison. For example,

> >> >> If [My textbox].Value = "Hallo" Then
> >> >>   Msgbox("Hallo My Friend")
> >> >> End If

> >> >> However, I don't think it's updated yet. So, if the
> >> >> previous value is "Hal" and I put "lo", it still
> thinks
> >> >> that "Hal" is the value until I change focus to a
> >> >> different object. Does anyone know how to overcome
> this
> >> >> problem ?

> >> >> Thanks

> >> >.

> >.



Mon, 21 Nov 2005 08:02:01 GMT  
 Update the value in a textbox

Thanks again, I just knew that there is a difference
between using .Value and .Text.

Usually I use AfterUpdate or LostFocus, where I am
assuming that using .Value or .Text would not matter, is
this correct ?

Quote:
>-----Original Message-----
>..Value doesn't have a value until the control has either
been updated with a
>new entry (it was Null before) or the control is bound to
a field that does
>have a value.

>--
>       Ken Snell
><MS ACCESS MVP>



>> Thanks a lot, I think it works now, it gives me the
>> updated one when I test it using MsgBox. One thing I am
>> confused though, why when I use .Value, it does not give
>> me the updated one ?

>> >-----Original Message-----
>> >The problem is that the code then runs after each
>> character is typed in. So
>> >it runs many times until you're done typing your entry.

>> >But, if that is what you want to do, then use the .Text
>> property of the
>> >textbox, not the .Value:

>> >If [My textbox].Text = "Hallo" Then
>> >    Msgbox("Hallo My Friend")
>> >End If

>> >--
>> >       Ken Snell
>> ><MS ACCESS MVP>



>> >> Thanks. However, after update is only trigered when
the
>> >> focus has moved to another object, while I want is,
>> after
>> >> finishing typing one character, it's trigered, that's
>> why
>> >> I use on change.

>> >> >-----Original Message-----
>> >> >Try using the AfterUpdate event of the textbox to
run
>> the
>> >> code.

>> >> >--
>> >> >       Ken Snell
>> >> ><MS ACCESS MVP>



>> >> >> I have a on change event in a textbox. Basically,
>> >> >> everytime a user changes the value, I want to do
>> string
>> >> >> comparison. For example,

>> >> >> If [My textbox].Value = "Hallo" Then
>> >> >>   Msgbox("Hallo My Friend")
>> >> >> End If

>> >> >> However, I don't think it's updated yet. So, if
the
>> >> >> previous value is "Hal" and I put "lo", it still
>> thinks
>> >> >> that "Hal" is the value until I change focus to a
>> >> >> different object. Does anyone know how to overcome
>> this
>> >> >> problem ?

>> >> >> Thanks

>> >> >.

>> >.

>.



Mon, 21 Nov 2005 22:39:22 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Textbox Value and Updating Database Record

2. Assigning value to textbox if textbox is a variable name

3. Changing the textbox's value of a textbox in a frame

4. Updating textbox via code not updating recordset

5. Updating table from report/textbox

6. Updating a textbox on a form while runing code???/

7. Updating textboxes in Word using UserForms fields

8. Databound textbox, updating the underlying SQL table ?

9. Updating a bound textbox

10. Detecting and displaying errors when updating bound TextBoxes

11. Textbox update

12. Updating a textbox on a form from another class

 

 
Powered by phpBB® Forum Software