I have code that wrties to an array (I think !) but I would like to have a debug.print to see the values to check. I carn't seem to find how to do this and my code will not work.
Dim db As Database
Dim qry As QueryDef
Dim rs As DAO.Recordset
Dim str As String
Dim i As Integer
Dim MyArray(10) As Currency
Set db = CurrentDb()
Set qry = db.QueryDefs("MyQuery"
Set rs = qry.OpenRecordset
For i = 0 To rs.Fields.Count - 1
str = rs.Fields(i).Name
If str Like "*Price1" Then 'If field name ends with "Price1" then
MyArray(i) = rs.Fields(i).Value
End If
Next
Debug.Print MyArray ' This is to show the values that have been put in the array (Errors on this line)
This is my first time usining arrays so I am a bit lost.
Thanks
Dim db As Database
Dim qry As QueryDef
Dim rs As DAO.Recordset
Dim str As String
Dim i As Integer
Dim MyArray(10) As Currency
Set db = CurrentDb()
Set qry = db.QueryDefs("MyQuery"
Set rs = qry.OpenRecordset
For i = 0 To rs.Fields.Count - 1
str = rs.Fields(i).Name
If str Like "*Price1" Then 'If field name ends with "Price1" then
MyArray(i) = rs.Fields(i).Value
End If
Next
Debug.Print MyArray ' This is to show the values that have been put in the array (Errors on this line)
This is my first time usining arrays so I am a bit lost.
Thanks