No current record err msg ....

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ronny Sigo

    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.OpenRecor dset(strSQL2)
    rstDocs.MoveFir st
    Dim aDocs(288) 'As String
    For Each StrVal In aDocs
    aDocs(StrVal) = Nz(Trim(rstDocs !Docname)) 'PROBLEM LINE
    Debug.Print aDocs(StrVal)
    rstDocs.MoveNex t
    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.OpenRecords et(strSQL)
    rst.MoveFirst



  • Lyle Fairfield

    #2
    Re: No current record err msg ....

    "Ronny Sigo" <ronniesigo@sky ynet.be> wrote in
    news:404a0656$0 $315$ba620e4c@n ews.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.OpenRecor dset(strSQL2)
    > rstDocs.MoveFir st
    > Dim aDocs(288) 'As String
    > For Each StrVal In aDocs
    > aDocs(StrVal) = Nz(Trim(rstDocs !Docname)) 'PROBLEM LINE
    > Debug.Print aDocs(StrVal)
    > rstDocs.MoveNex t
    > 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.OpenRecords et(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.Exec ute("SELECT DISTINCT
    fldDescription " _
    & "FROM tbl2002Transact ions " _
    & "WHERE fldDescription IS NOT NULL " _
    & "ORDER BY fldDescription; ")
    a = Split(r.GetStri ng(, , , ","), ",")

    and that's it ...

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

    Comment

    • Ronny Sigo

      #3
      Re: No current record err msg ....

      Works great Lyle :) Thanks

      "Lyle Fairfield" <MissingAddress @Invalid.Com> schreef in bericht
      news:Xns94A4913 4B2774FFDBA@130 .133.1.4...[color=blue]
      > "Ronny Sigo" <ronniesigo@sky ynet.be> wrote in
      > news:404a0656$0 $315$ba620e4c@n ews.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.OpenRecor dset(strSQL2)
      > > rstDocs.MoveFir st
      > > Dim aDocs(288) 'As String
      > > For Each StrVal In aDocs
      > > aDocs(StrVal) = Nz(Trim(rstDocs !Docname)) 'PROBLEM LINE
      > > Debug.Print aDocs(StrVal)
      > > rstDocs.MoveNex t
      > > 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.OpenRecords et(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.Exec ute("SELECT DISTINCT
      > fldDescription " _
      > & "FROM tbl2002Transact ions " _
      > & "WHERE fldDescription IS NOT NULL " _
      > & "ORDER BY fldDescription; ")
      > a = Split(r.GetStri ng(, , , ","), ",")
      >
      > and that's it ...
      >
      > --
      > Lyle
      > (for e-mail refer to http://ffdba.com/contacts.htm)[/color]


      Comment

      • Lyle Fairfield

        #4
        Re: No current record err msg ....

        Chuck Grimsby <c.grimsby@worl dnet.att.net.in valid> wrote in
        news:6f3m40t4fs u42ucvvtum3icm4 o58fuu42e@4ax.c om:
        [color=blue]
        > On 6 Mar 2004 19:16:19 GMT, Lyle Fairfield
        ><MissingAddres s@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)

        Comment

        Working...