this code does not work, why? 
Author Message
 this code does not work, why?

I'm having trouble with the following code.
 the( select * from import_dbs_to_compare )
  thru (Do While i <= rs.RecordCount )

I need to loop X number of times based on the number of
records in "import_dbs_to_compare"

none of the example or help option work
if I add a "dim db as database" it generates an
error "user object not defined"

Public Function select_count_import_records()

    Dim retval As Long

    Set dbsA = CurrentDb
    Dim rs As Recordset

    Dim strSQL As String

//     everything works except this section

   strSQL = "select * from import_dbs_to_compare"

   Set rs = dbsA.OpenRecordset(strSQL)
   rs.MoveLast
//

   Do While i <= rs.RecordCount

     strSQL = "insert into report_options (option1,
option2, option3, option8) " _
          & " SELECT First([import_dbs_to_compare].
[Field2]) , First([import_dbs_to_compare].[Field3]), " _
          & " First([import_dbs_to_compare].[Field2]) ,
First([import_dbs_to_compare].[Field3]) " _
          & " FROM import_dbs_to_compare"
     dbsA.Execute strSQL

     retval = select_first_import_record()

     i = 1 + 1
   Loop
End Function



Mon, 24 May 2004 02:55:44 GMT  
 this code does not work, why?
Are you using Access 2000 or 2002?  If so, do you have a reference to the
DAO 3.6 Object Library?  The reference is not created by default in A2K+.
See my answer in the thread "Dim dbs as Database in 2000" in this newsgroup.

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(to reply via e-mail, remove NOSPAM from address)


Quote:
> I'm having trouble with the following code.
>  the( select * from import_dbs_to_compare )
>   thru (Do While i <= rs.RecordCount )

> I need to loop X number of times based on the number of
> records in "import_dbs_to_compare"

> none of the example or help option work
> if I add a "dim db as database" it generates an
> error "user object not defined"

> Public Function select_count_import_records()

>     Dim retval As Long

>     Set dbsA = CurrentDb
>     Dim rs As Recordset

>     Dim strSQL As String

> //     everything works except this section

>    strSQL = "select * from import_dbs_to_compare"

>    Set rs = dbsA.OpenRecordset(strSQL)
>    rs.MoveLast
> //

>    Do While i <= rs.RecordCount

>      strSQL = "insert into report_options (option1,
> option2, option3, option8) " _
>           & " SELECT First([import_dbs_to_compare].
> [Field2]) , First([import_dbs_to_compare].[Field3]), " _
>           & " First([import_dbs_to_compare].[Field2]) ,
> First([import_dbs_to_compare].[Field3]) " _
>           & " FROM import_dbs_to_compare"
>      dbsA.Execute strSQL

>      retval = select_first_import_record()

>      i = 1 + 1
>    Loop
> End Function



Mon, 24 May 2004 04:13:14 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Why does the following code not work?

2. Help Please...Code does not work why?

3. Why code will not work?

4. Why does this piece of code work with Word 97 but not Word 2000

5. why will this code not work

6. Find/Replace code not working - why?

7. Why this code does not work:

8. why the @#$@% does this code not work

9. Anyone know why this code only works in 32bit and not 16 bit vb 4

10. Why this code does not work properly?

11. Why does this code not work?

12. Why does this simple code not work?

 

 
Powered by phpBB® Forum Software