By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,099 Members | 947 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,099 IT Pros & Developers. It's quick & easy.

No current record err msg ....

P: n/a
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

Nov 12 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Ronny Sigo" <ro********@skyynet.be> wrote in
news:40*********************@news.skynet.be:
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


Your DOA coding is very inefficient. Why waste time on it? ADO is much more
powerful and simple:

Dim a() As String
Dim r As ADODB.Recordset
Set r = CurrentProject.Connection.Execute("SELECT DISTINCT
fldDescription " _
& "FROM tbl2002Transactions " _
& "WHERE fldDescription IS NOT NULL " _
& "ORDER BY fldDescription;")
a = Split(r.GetString(, , , ","), ",")

and that's it ...

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #2

P: n/a
Works great Lyle :) Thanks

"Lyle Fairfield" <Mi************@Invalid.Com> schreef in bericht
news:Xn*******************@130.133.1.4...
"Ronny Sigo" <ro********@skyynet.be> wrote in
news:40*********************@news.skynet.be:
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
Your DOA coding is very inefficient. Why waste time on it? ADO is much

more powerful and simple:

Dim a() As String
Dim r As ADODB.Recordset
Set r = CurrentProject.Connection.Execute("SELECT DISTINCT
fldDescription " _
& "FROM tbl2002Transactions " _
& "WHERE fldDescription IS NOT NULL " _
& "ORDER BY fldDescription;")
a = Split(r.GetString(, , , ","), ",")

and that's it ...

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)

Nov 12 '05 #3

P: n/a
Chuck Grimsby <c.*******@worldnet.att.net.invalid> wrote in
news:6f********************************@4ax.com:
On 6 Mar 2004 19:16:19 GMT, Lyle Fairfield
<Mi************@Invalid.Com> wrote:
Your DOA coding ...


DOA? Dead On Arrival? <LOL!>


How could I have made such a silly mistake? It must have been my evil twin,
Kyle.

--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
Nov 12 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.