Add column headings to a listView

J

John F

Excel 2000

I am filling a list view in a form with data from an oracle database.
Eveyting works fine but I am not able to add column headings. Is this
possible??

Regards,

John.
 
J

james.igoe

Although I have created a function to fill various ActiveX listboxes,
normally, one could simply modify the listbox to have multiple columns,
each with column widths, and binding the control to a particular
column.

What isn't working for you?
 
J

james.igoe

ActiveX modifications; watch ocxCTL, since that is the ActiveX listbox
being filled:

Function ListBoxFill (ocxCTL As Object, strQuery As String, intSubItems
As Integer, intFormatWidth As Integer) As Boolean

'variables for current data
Dim dbcurrentdb As DAO.Database
Dim rsCTL As DAO.Recordset
Set dbcurrentdb = currentdb()

Dim intCount As Integer
Dim ocxRows As ListItem

Dim Response As Long

On Error GoTo ErrorTrap

Set rsCTL = dbcurrentdb.OpenRecordset(strQuery, dbOpenSnapshot)

With ocxCTL
.listitems.Clear
.ColumnHeaders.Clear
End With

If intFormatWidth = intFormattingWidth0 Then
With ocxCTL
.ColumnHeaders.Add , , "", 1100
End With
End If
If intFormatWidth = intFormattingWidth1 Then
With ocxCTL
.ColumnHeaders.Add , , "", 1870
End With
End If
If intFormatWidth = intFormattingWidth2 Then
With ocxCTL
.ColumnHeaders.Add , , rsCTL.Fields(0).Name, 800
.ColumnHeaders.Add , , rsCTL.Fields(1).Name, 3000
End With
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top