Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vertical Scrollbar problem on Listbox 1

Status
Not open for further replies.

rustychef

Technical User
Sep 2, 2004
63
US
I have listbox on my form that shows wire splice information. Also on the form is a button that “toggles” the listbox view between spliced wires and all wires. When the form first opens I cannot use the VERTICAL scroll bar. Once I click on toggle button the scroll bar starts working.
The code used to toggle the listbox view is essentially the same. I have tried shrinking and increasing the size of the listbox to no avail. If I shrink the listbox to make the horizontal scrollbar show up, it works fine even tho the vertical still doesnt.
The Form_Open calls ToggleRowsource() using the following statement: ToggleRowsource False
The form button calls ToggleRowsource() using the following statement:
ToggleRowsource CBool(Me.lblShow1c.Caption = "ALL") The CBool() function is based on the wording of the button at the time that it is pressed.
All fields that have “Id” in them are Long, and those with Name are String

Here is the coding for ToggleRowsource()

Sub ToggleRowsource(fSHOW_ALL As Boolean)
Me.lstSpliceSelect.RowSource = ""
If fSHOW_ALL Then
'Select ALL refdes records
Me.lstSpliceSelect.RowSource = _
"SELECT [Refdes].[Refdes_Id], [Refdes].[Name], " & _
"[Refdes].[Type_Id], [Pin].[Name] " & _
"FROM [Refdes] " & _
"INNER JOIN [Pin] " & _
"ON [Refdes].[Refdes_Id] = [Pin].[Refdes_Id] " & _
"ORDER BY [Refdes].[Name];"
Me.lblShow1c.Caption = "SPLICES"
Me.btnShow.ControlTipText = "Click to Display SPLICE RefDes Data"
Else
'Select all records where the PinName begins with "SP" (its a splice)
Me.lstSpliceSelect.RowSource = _
"SELECT [Refdes].[Refdes_Id], [Refdes].[Name], " & _
"[Refdes].[Type_Id], [Pin].[Name] " & _
"FROM [Refdes] " & _
"INNER JOIN [Pin] " & _
"ON [Refdes].[Refdes_Id] = [Pin].[Refdes_Id] " & _
"WHERE ((([Pin].[Name]) Like 'SP*')) " & _
"ORDER BY [Refdes].[Name];"
Me.lblShow1c.Caption = "ALL"
Me.btnShow.ControlTipText = "Click to Display ALL RefDes Data"
End If

Me.txtNumRefDes.Value = Me.lstSpliceSelect.ListCount
Me.lstSpliceSelect.Requery

End Sub 'ToggleRowsource

Is there something Im doing wrong to keep the VERTICAL scrollbar from enabling?

Additional Listbox Info if it helps:
ColumnWidths: 0.5";1";0.25";0.5"
ColumnCount: 4
BoundColumn: 1
RowSourceType: Table/Query

Again, it is only an issue when the form first opens. It goes away once the form button is pushed.
 
The Form_Open calls ToggleRowsource()
I'd use the Load event procedure instead.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
That's it. Thank-you so very much. Thats happend to me before, but I restructured my form to get around it, and couldnt do it this time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top