473,396 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

No current record err msg ....

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
3 3958
"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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tony | last post by:
I have a form in access that has 5 fields for a certain record: 1)Date mailed, 2)Date received, 3)Date completed 4)Foreign Content amount and 5)record number. If the foreign content (FC)is >15% of...
2
by: Tony | last post by:
Hello, I am having difficulty in getting the current record of the current form to show after pressing a command button that takes me to another form. The command button takes me to another...
4
by: DBQueen | last post by:
I have a subform which is in Continuous Forms view. I have added a button to the bottom of the page to move to the next record using the button wizard (result: DoCmd.GoToRecord , , acNext). I...
3
by: Maria | last post by:
Is there another way to delete the current record in a subform from the main form, another subform or a sub-subform other than setting focus on a field in the subform and using run command...
8
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
1
by: 4004 | last post by:
I would like to open a columnar form (so I can see all the details) from a datasheet form (so I can see what is there) but keep the same recordset and current record. I can do the recordset set...
5
by: christianlott1 | last post by:
I admit my form is pretty complex and may need a total overhaul - I have two subforms synchronized on a form through an unbound text box. When I enter a new record in the second subform it used...
1
by: roveagh1 | last post by:
Hi I've been using the 2 year old link below to repeat values from previous record field into current corresponding field. It's worked fine for text but the last piece of advice was to use the same...
5
by: eighthman11 | last post by:
Hi everyone: This is probably a pretty simple problem but it is driving me nuts. Using Access 2000. I have a continuous form which list several thousand inventory items. The user can enter a...
6
by: MLH | last post by:
Cut this little FN out-a-Access 97 HELP. It makes mention of the new record being made the current record. Is it the Update method responsible for that - or the Bookmark method? Which one? ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.