steveB2006
Programmer
I am trying to implement a "struct" or user-defined type where I can implicitly name but cannot implement with the NEW keyword. I have resorted to an array structure
I would prefer to declare a new struct for each record simply giving each a new name like struct10 and accessing the data by address rather than using the array method. However I cannot create the struct using either statements:
I could be that I may require a library reference also under the tools menu. Any ideas??
thanks,
steveB
Code:
Option Explicit
Public Type InvoiceRecord
ID as Integer
invDate as Date
End type
Public Function loadStruct()
Dim invRcd(1 to 5) as InvoiceRecord
Dim i as integer
Dim rcdDate as Date
rcdDate = Date
For i = 1 To 5 Step 1
incRcd(i).ID = i
invRcd(i).invDate = rcdDate
MsgBox "invRcd" & i & "ID is " & invRcd(i).ID
MsgBox "invRcd" & i & "Date is " & invRcd(i).invDate
rcdDate = rcdDate + 1
Next
End Function
I would prefer to declare a new struct for each record simply giving each a new name like struct10 and accessing the data by address rather than using the array method. However I cannot create the struct using either statements:
Code:
Dim bla as New InvoiceRecord
'or
Set bla = New InvoiceRecord
I could be that I may require a library reference also under the tools menu. Any ideas??
thanks,
steveB