HaworthBantam
Programmer
I have a ListView box on a form called lvwPostings.
On opening the form, code is executed that creates an Adodc recordset. The records contained within the recordset then need to be displayed within the ListView box. I am, however, having problems displaying the records.
The code so far is.....
Private Sub Form_Load()
Dim strPostingsSQL As String
strPostingsSQL ="SELECT * FROM tblPostings WHERE RemRef = " & lngRecordID & " AND Type =" & Chr(34) & strTaxType & Chr(34)
Adodc2.ConnectionString = strConnectionString
Adodc2.CommandType = adCmdText
Adodc2.RecordSource = strPostingsSQL
Adodc2.Refresh
With lvwPosings
.View = lvwReport
.FullRowSelect = True
.ColumnHeaders.Add,,"RemRef"
.ColumnHeaders(1).Width = 1000
.ColumnHeaders.Add,,"Tax"
.ColumnHeaders(2).Width = 1000
.ColumnHeaders.Add,,"NIC"
.ColumnHeaders(3).Width = 1000
End With
The code up to this point works. I know that through the use of message boxes and stepping through.
I'm now unsure how to populate the ListView box from the Adodc recordset. I do know that I'll need to cycle through the recordset and add each record one at a time, but the code I've written does not work, and I don't wish to embarrass myself by displaying it here !
I know I'm missing something numpty but any help getting me back on track would be a great help.
Thanks.
On opening the form, code is executed that creates an Adodc recordset. The records contained within the recordset then need to be displayed within the ListView box. I am, however, having problems displaying the records.
The code so far is.....
Private Sub Form_Load()
Dim strPostingsSQL As String
strPostingsSQL ="SELECT * FROM tblPostings WHERE RemRef = " & lngRecordID & " AND Type =" & Chr(34) & strTaxType & Chr(34)
Adodc2.ConnectionString = strConnectionString
Adodc2.CommandType = adCmdText
Adodc2.RecordSource = strPostingsSQL
Adodc2.Refresh
With lvwPosings
.View = lvwReport
.FullRowSelect = True
.ColumnHeaders.Add,,"RemRef"
.ColumnHeaders(1).Width = 1000
.ColumnHeaders.Add,,"Tax"
.ColumnHeaders(2).Width = 1000
.ColumnHeaders.Add,,"NIC"
.ColumnHeaders(3).Width = 1000
End With
The code up to this point works. I know that through the use of message boxes and stepping through.
I'm now unsure how to populate the ListView box from the Adodc recordset. I do know that I'll need to cycle through the recordset and add each record one at a time, but the code I've written does not work, and I don't wish to embarrass myself by displaying it here !
I know I'm missing something numpty but any help getting me back on track would be a great help.
Thanks.