0

IN MS access FORM i have a list box column which is filled with colour names.

Once the form is loaded i want to make backcolour of that record same as the one mentioned in that column.

Regards,
Dinil

3
Contributors
8
Replies
9
Views
8 Years
Discussion Span
Last Post by QVeen72
0

I am gettin error message
"The RowSourceType" Property must be set to "Value List" to use this method.
The code is stoping at
lstProject_report.AddItem "Color " & I
in Form_load()
-------------X_-------------------X-------------------
Private Sub Form_Load()
Dim I As Integer
For I = 0 To 15
'Load a List of 0 to 15 with the Item Data
'Set to the QBColors 0 - 15
lstProject_report.AddItem "Color " & I
List1.itemData(List1.NewIndex) = QBColor(I)
Next
'Subclass the "Form", to Capture the Listbox Notification Messages
lPrevWndProc = SetWindowLong(hwnd, GWL_WNDPROC, AddressOf SubClassedList)
End Sub

------------------X-------------------X-----------------X_------

My list box uses a quey where row source is "Table/Query".

0

Make
List1.itemData(List1.NewIndex) = QBColor(I)
as
lstProject_report.itemData(lstProject_report.NewIndex) = QBColor(I)

0

I want to colour the 8 the column in evry row and movement row is done by "I".

For I = 0 To lstProject_report.ListCount
lstProject_report.Column(8, 1) = QBColor(I)
Next

I am getting error "RUN TIME ERROR:424" OBJECT REQUIRED at the following line.

lstProject_report.Column(8, 1) = QBColor(I)


Please help

0

Hi,

Just an Alternative Suggestion..
Why Not Use a MSFlexGridControl..
Add a Grid Control and rename it as "GRD"

And in FormLoad, Write This Code:

Dim i As Integer
    Me.Grd.Rows = 16
    Me.Grd.Cols = 2
    For i = 1 To 15
        Me.Grd.Row = i
        Me.Grd.Col = 0
        Me.Grd.Text = i
        Me.Grd.Col = 1
        Me.Grd.CellBackColor = QBColor(i)
    Next

To Get Selected Color Index, use
Me.Grd.Row
OR
Me.GRD.TextMatrix(Me.Grd.Row,0)

Regards
Veena

0

Hi,

Just an Alternative Suggestion..
Why Not Use a MSFlexGridControl..
Add a Grid Control and rename it as "GRD"

And in FormLoad, Write This Code:

Dim i As Integer
    Me.Grd.Rows = 16
    Me.Grd.Cols = 2
    For i = 1 To 15
        Me.Grd.Row = i
        Me.Grd.Col = 0
        Me.Grd.Text = i
        Me.Grd.Col = 1
        Me.Grd.CellBackColor = QBColor(i)
    Next

To Get Selected Color Index, use
Me.Grd.Row
OR
Me.GRD.TextMatrix(Me.Grd.Row,0)

Regards
Veena

0

My requirement from list is

1) Multiple selection of records.

2)Back colouring of record.

Please suggest which Grid should i go with.?FLEXGRID or DATAGRID

I want to choose a grid which will serve my above purpose and also is less complex.

0

Hi,

MSFlexGrid is the best Option..
To make Multiple Selection of Rows, you can follow this Logic:


Say, you want to make Column 4 as Selection Column.
FontName Marlett has character "b" looking like a Check-Mark Icon.
What you can do is Set whole of the column name = "Marlett", and In Click-event Toggle between "b" and empty...

Write this code in Grd_Click Event:

If Grd.Row >0 And Grd.Col=4 Then 
   Grd.CellFontname ="Marlett" 
   If Trim(Grd.Text) = "" Then 
       Grd.Text ="b" 
   Else 
       Grd.Text = "" 
   End If 
End If

And In Save/Print Button, Loop thru the Rows, and Check For

Dim i As Integer
For i = 1 To Grd.Rows-1
    If Trim(Grd.TextMatrix(i ,4)) ="b"  Then
        MsgBox "Row Number : " & i & " Is Selected"
    End If
Next i

Alternatively, Webdings font has also got font "a" looking like a Check Mark..
you can use Either..

Regards
Veena

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.