Hello all,
I am trying out arrays for the first time now. While running this code below
I get the error: "No current record" (or at least something like that, cause
I have the dutch version)
Can anybody tell me what I am doing wrong ? I have put "PROBLEM LINE" after
the line that causes the error ....
Dim I As Variant
Dim StrVal As Variant
Dim aStatus(288) As Integer
Dim nTeller As Integer
nTeller = 0
Do While nTeller < 288
aStatus(nTeller) = nTeller
nTeller = nTeller + 1
Loop
'*****************************************
Dim dbase As DAO.Database
Dim rstDocs As DAO.Recordset
Dim strSQL2 As String
strSQL2 = "SELECT * FROM tblDocnames_NL_EN"
Set dbase = CurrentDb
Set rstDocs = dbase.OpenRecordset(strSQL2)
rstDocs.MoveFirst
Dim aDocs(288) 'As String
For Each StrVal In aDocs
aDocs(StrVal) = Nz(Trim(rstDocs!Docname)) 'PROBLEM LINE
Debug.Print aDocs(StrVal)
rstDocs.MoveNext
Next StrVal
'*****************************************
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim nHoeveelMails As Long
nHoeveelMails = 0
strSQL = "SELECT * FROM tblDhscmails where [enable] = True"
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strSQL)
rst.MoveFirst