Make TextBoxName.Value current and display correctly

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

Using AccessXP in A2000 mode.

TextBoxName is an unbound textbox on a form. TextBoxName.Text is always current
while TextBoxName.Value is not current when the OnChange event occurs. So to
make TextBoxName.Value current, my code in the OnChange event looks like:

DoCmd.RunCommand acCmdSaveRecord
Code to do other stuff....

Now say I want to enter 532 in the textbox. I type a 5 and the textbox displays
5; I type a 3 and the textbox displays 35; finally I type a 2 and the textbox
displays 235.

I need to save the record (I think) to make the value in the textbox current
when the OnChange event occurs and I need the value in the textbox to be 532 not
235! Suggestions???

Thanks!

Steve
 
Allen,

Thank you for responding!

Note that the application will only be used on a single laptop.

I'm trying to use a textbox/listbox pair to search for a particular 1 to 4 digit
number and then to have a form jump to that record. I know that maybe just
entering the number and using the AfterUpdate event would be simpler, there's a
textbox/listbox pair also for entering a text name and jumping to the record. So
for consistency I'm using the same method for both text and numeriacl entry. I'm
using the method found on p359 of the Access97 Developers Handbook(Getz) if you
have the book.

The procedure uses the findfirst method. You begin entering characters in the
textbox and the listbox automatically scrolls to the first record that begine
with what you enter n the textbox (just like the Help file). The trouble with
using the text property for numbers is say you want to find 532. Entering the 5
is no problem. But when you enter the 3, findfirst looking for the first record
= to the textbox goes to 6 rather than 53.

I have solved the problem I posted by using TextBox.Value and then in the
OnChange event code put a statement setting the SelLength property to 1000
ensuring the next number entered is at the right of the previous entry(s). I
guess as you say it is horribly inefficient but since the application runs on a
single laptop it probably doesn't matter.

Steve
 
Back
Top