Connecting Tech Pros Worldwide Forums | Help | Site Map

No current record err msg ....

Ronny Sigo
Guest
 
Posts: n/a
#1: Nov 12 '05
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




Lyle Fairfield
Guest
 
Posts: n/a
#2: Nov 12 '05

re: No current record err msg ....


"Ronny Sigo" <ronniesigo@skyynet.be> wrote in
news:404a0656$0$315$ba620e4c@news.skynet.be:
[color=blue]
> 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[/color]

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)
Ronny Sigo
Guest
 
Posts: n/a
#3: Nov 12 '05

re: No current record err msg ....


Works great Lyle :) Thanks

"Lyle Fairfield" <MissingAddress@Invalid.Com> schreef in bericht
news:Xns94A49134B2774FFDBA@130.133.1.4...[color=blue]
> "Ronny Sigo" <ronniesigo@skyynet.be> wrote in
> news:404a0656$0$315$ba620e4c@news.skynet.be:
>[color=green]
> > 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[/color]
>
> Your DOA coding is very inefficient. Why waste time on it? ADO is much[/color]
more[color=blue]
> 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)[/color]


Lyle Fairfield
Guest
 
Posts: n/a
#4: Nov 12 '05

re: No current record err msg ....


Chuck Grimsby <c.grimsby@worldnet.att.net.invalid> wrote in
news:6f3m40t4fsu42ucvvtum3icm4o58fuu42e@4ax.com:
[color=blue]
> On 6 Mar 2004 19:16:19 GMT, Lyle Fairfield
><MissingAddress@Invalid.Com> wrote:[color=green]
>>Your DOA coding ...[/color]
>
> DOA? Dead On Arrival? <LOL!>[/color]

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)
Closed Thread