M
Max Moor
Hi All,
Thanks to Alex and George, I can instanciate the MyListView class, and
mostly use it. I'm getting an error I don't understand, though.
In the class is function Fill. The first part of it is here:
Public Function Fill(strDomain As String, varWidths As Variant) As Boolean
On Error GoTo Err_Handler
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim intTotCount As Integer
Dim intCount1 As Integer
Dim intCount2 As Integer
Dim colNew As ColumnHeader
Dim itmNewLine As ListItem
With mobjListViewRef ' The class module object reference
'Clear the ListView control.
.ListItems.Clear
.ColumnHeaders.Clear
'Set Variables.
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strDomain)
'Set Column Headers.
For intCount1 = 0 To rst.Fields.Count - 1
'Set colNew = .ColumnHeaders.Add(, , rst(intCount1).Name,
..Width * CSng(varWidths(intCount1)))
Next intCount1
....
This function is used to fill the referenced listview with data. The
whole thing works except the line where I set the width of a column with
the .ColumnHeaders.Add method. I've done some experimenting, and found
that it's the .Width throwing the error!
The error says the object doesn't support this property. I might
consider that something is screwy with my mobjListViewRef object, but all
the other calls in the function work fine. Sure enough though, if I
replace .Width with 9000, roughly the twips width of the form, it comes
right up.
Anyone have any ideas what I'm doing wrong with this one?
Regards,
Max
Thanks to Alex and George, I can instanciate the MyListView class, and
mostly use it. I'm getting an error I don't understand, though.
In the class is function Fill. The first part of it is here:
Public Function Fill(strDomain As String, varWidths As Variant) As Boolean
On Error GoTo Err_Handler
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim intTotCount As Integer
Dim intCount1 As Integer
Dim intCount2 As Integer
Dim colNew As ColumnHeader
Dim itmNewLine As ListItem
With mobjListViewRef ' The class module object reference
'Clear the ListView control.
.ListItems.Clear
.ColumnHeaders.Clear
'Set Variables.
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strDomain)
'Set Column Headers.
For intCount1 = 0 To rst.Fields.Count - 1
'Set colNew = .ColumnHeaders.Add(, , rst(intCount1).Name,
..Width * CSng(varWidths(intCount1)))
Next intCount1
....
This function is used to fill the referenced listview with data. The
whole thing works except the line where I set the width of a column with
the .ColumnHeaders.Add method. I've done some experimenting, and found
that it's the .Width throwing the error!
The error says the object doesn't support this property. I might
consider that something is screwy with my mobjListViewRef object, but all
the other calls in the function work fine. Sure enough though, if I
replace .Width with 9000, roughly the twips width of the form, it comes
right up.
Anyone have any ideas what I'm doing wrong with this one?
Regards,
Max