View Full Version : Troubleshoot a listbox


3divine
10-12-2001, 08:42 AM
I have a list box where records are filtered depending upon the value entered in a text box.

All of a sudden strange thing started happening although it seemed to happen only to certain records that are almost identical but perhaps vary on certain characteristics.

Example:

If there are 3 records displayed on the list box and the user wants the 3rd record from the list, somehow my listbox seemed to default to the first record and grabs that record and display's the result in another textbox.

Does anyone has a clue?

Shep
10-12-2001, 08:52 AM
Let's have a look at the code behind the TextBox and the ListBox.

3divine
10-12-2001, 09:06 AM
Private Sub lbxCuttingTools_Click()
Me.lbxCuttingTools.Requery
Me.lbxInserts.Requery
Me.lstAdapterResult.Requery
End Sub

Private Sub cboFindTool_AfterUpdate()
'Me.cboFindToolSize = ""
'Me.cboFindToolSize.Requery
Me.lbxCuttingTools.Requery
Me.lbxCuttingTools.SetFocus
End Sub

Shep
10-12-2001, 09:30 AM
It's difficult to figure out what your listbox and combobox are supposed to be doing, as no recordsources or textboxes are mentioned.
I must apologize - more information is needed.
I think we will need to know how your records are filtered by the textbox you mentioned, and whether your users are to select one of the resulting values in the listbox and if so, how that value is placed into "another textbox" that you mentioned, and a detailed description of the function that your form is providing for your users.

Either that, or I'm overlooking something really obvious here. http://www.access-programmers.co.uk/ubb/smile.gif

Shep

3divine
10-12-2001, 10:25 AM
I hope this helps a bit http://www.access-programmers.co.uk/ubb/smile.gif

1) A user selects a value from a combo box or could also type in the first 3 char will display records that matches.

2) After the user has determined which record is appropriate, that record is transfered to another textbox in this case is txtCuttingTool.

3) My problem is sometimes it grabs the correct data but sometimes it doesn't. As stated in my first post, it hasn't been consistent as sometimes it wants to grab the very first record in a row.


Name:cboFindTool
Row Sourse:SELECT DISTINCTROW tblToolTypes.[Tool Types] FROM tblToolTypes;

Event:
Private Sub cboFindTool_AfterUpdate()
Me.cboFindToolSize = ""
Me.cboFindToolSize.Requery
Me.lbxCuttingTools.Requery
Me.lbxCuttingTools.SetFocus
End Sub

Name:lbxCuttingTools
Row Source:SELECT DISTINCTROW qryFindCuttingTool.ID, qryFindCuttingTool.Partnumber,
qryFindCuttingTool.[Cutting Tool], qryFindCuttingTool.Insert, qryFindCuttingTool.ToolSizes, qryFindCuttingTool.Comments FROM qryFindCuttingTool ORDER BY qryFindCuttingTool.ToolSizes;

Event:
Private Sub lbxCuttingTools_Click()
Me.lbxCuttingTools.Requery
Me.lbxInserts.Requery
Me.lstAdapterResult.Requery
End Sub

Name:TxtCuttingTool
Control Source:=[lbxCuttingTools].[Column](2)

If you need more info just ask away and thanks

Shep
10-12-2001, 11:41 AM
Ok, I'll take a close look when I get home (in a few hours).
Right now, I'm slaving away for an evil boss.

I'll get back with you a bit later. http://www.access-programmers.co.uk/ubb/smile.gif