E
Erazmus
Hi Guys,
I have an issue with the following code -
I have worked this together from examples found on this site, the
class indexing is thanks to Chip Pearson see groups topic "Using an
index with a class module?"
Public bulkloadFile As clBulkloadfile
....
Sub testing()
Dim currentField As clBulkloadField
Set currentField = New clBulkloadField
Dim index As Integer
If bulkloadFile Is Nothing Then
Set bulkloadFile = New clBulkloadfile
End If
For index = 1 To 12
With currentField
.contents = "Hi : " & index
.name = tyStatementDetail
.label = "Hi-Ho"
End With
bulkloadFile.add newField:=currentField
MsgBox "Index = " & index & vbCrLf & _
"Current Field" & vbCrLf & _
" Contents: " & currentField.contents & vbCrLf & _
" Label: " & currentField.label & vbCrLf & _
"bulkload file(index)" & vbCrLf & _
" Contents: " & bulkloadFile(index).contents & vbCrLf &
_
" Label: " & bulkloadFile(index).label & vbCrLf
''
*******************************************************************************************
'' The MsgBox above produces the expected results.
''
*******************************************************************************************
Next
For index = 1 To bulkloadFile.count
MsgBox "Index = " & index & " Contents = " &
bulkloadFile(index).contents
Next
''
***************************************************************************************************************
'' The MsgBox above produces the same thing 12 times, ie. 12x the
last entry from the first loop.
''
***************************************************************************************************************
Set bulkloadFile = Nothing
End Sub
As I'm fairly new to the whole creating and using my own of classes,
it's probably something obvious that I'm missing, would anyone know
where I should start looking?
Any help appreciated.
Cheers,
Deon.
I have an issue with the following code -
I have worked this together from examples found on this site, the
class indexing is thanks to Chip Pearson see groups topic "Using an
index with a class module?"
Public bulkloadFile As clBulkloadfile
....
Sub testing()
Dim currentField As clBulkloadField
Set currentField = New clBulkloadField
Dim index As Integer
If bulkloadFile Is Nothing Then
Set bulkloadFile = New clBulkloadfile
End If
For index = 1 To 12
With currentField
.contents = "Hi : " & index
.name = tyStatementDetail
.label = "Hi-Ho"
End With
bulkloadFile.add newField:=currentField
MsgBox "Index = " & index & vbCrLf & _
"Current Field" & vbCrLf & _
" Contents: " & currentField.contents & vbCrLf & _
" Label: " & currentField.label & vbCrLf & _
"bulkload file(index)" & vbCrLf & _
" Contents: " & bulkloadFile(index).contents & vbCrLf &
_
" Label: " & bulkloadFile(index).label & vbCrLf
''
*******************************************************************************************
'' The MsgBox above produces the expected results.
''
*******************************************************************************************
Next
For index = 1 To bulkloadFile.count
MsgBox "Index = " & index & " Contents = " &
bulkloadFile(index).contents
Next
''
***************************************************************************************************************
'' The MsgBox above produces the same thing 12 times, ie. 12x the
last entry from the first loop.
''
***************************************************************************************************************
Set bulkloadFile = Nothing
End Sub
As I'm fairly new to the whole creating and using my own of classes,
it's probably something obvious that I'm missing, would anyone know
where I should start looking?
Any help appreciated.
Cheers,
Deon.