KeyCode Error

SBullard

Registered User.
Local time
Today, 10:39
Joined
Dec 17, 2011
Messages
13
I have a form showing a list of products. There are over 10,000 items, so the user has the ability to add a product type which will filter the list. There is also a text field where the user can start to type an item name and the list will filter on each keystroke to narrow down the list. I am using the following code.

Private Sub txtItem_KeyUp(KeyCode as Integer, Shift as Integer)

Dim lngLength As Long
Dim myKeyCode As Integer
Dim myTest As String


myKeyCode = KeyCode

If myKeyCode <> 9 Then
If myKeyCode <> 8 Then
myText = myText & Chr(myKeyCode)
Me.txtItem = ""
Me.txtItem = myText
Else
lngLength = Len(myText)
myText = Left(myText, lngLength - 1)
Me.txtItem = ""
Me.txtItem = myText
End If
FilterSubfrm
End If

End Sub

MyText then is used with other criteria in the FilterSubfrm sub-routine. The code is in a front-end system attached to a network. The tables are stored in the public folder of one of the networked computers. (There are a total of 5 computers on the network.)

Some of the computers are showing incorrect data - entering a 0 results in an n with a tilde, for example. I can't figure out why it would work on one computer and not another, unless there is something in the individual computer settings regarding language, but I can't find it.

Any suggestions?
 
I have a form showing a list of products. There are over 10,000 items, so the user has the ability to add a product type which will filter the list. There is also a text field where the user can start to type an item name and the list will filter on each keystroke to narrow down the list. I am using the following code.

What do you mean by Add a Product Type?
Why not have a ProductType lookup table or whatever you need and filter by that before you start into the Products.

Also you could use a cascading combo set up

first combo to select productType and then use the result to filter the second combo.
You could also use the On Change event of the second combo to do your lookup by each character typed.

see free videos
Cascading combos
http://www.datapigtechnologies.com/flashfiles/combobox1.html
http://www.datapigtechnologies.com/flashfiles/combobox2.html

There is a sample mdb with the On Change event at post #3 at
http://www.accessforums.net/programming/value-field-change-14018.html

Allen Browne has a technique for handling combos with thousands of records
http://allenbrowne.com/ser-32.html
 
I do have a combo box where the user selects the product type and that result filters the other combo. That all works fine.

The problem is on the item field where I want to filter it every time the user types a new key. The code above works on some computers, but I have other computers where the user gets a different result - types a 0 and the field shows something different. It is like the keycode feature of the code gets scrambled - but only on some computers!
 
For further clarification, I have a combo box for Product Type which then filters another combo box for a "sub type", and then a text field to enter the product name directly.

It is the text field that I am trying to use as part of the criteria for filtering a subform containing the product information, and that is where the problem is.
 
Look at the technique in the mdb mentioned in previous post.

Seems there was more info Product Type and sub type than first mentioned.

Can you post a jpg of the form and subform?
 

Users who are viewing this thread

Back
Top Bottom