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 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.