Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2003
    Posts
    3

    CurrentDB.OpenRecordset()

    What is the equivalent of the following VB 6.0 code in VBA (using Access 2000):

    Dim rst As Recordset
    Set rst = DB.OpenRecordset("SELECT * FROM TEMP")

    So far I have:

    Dim temprec As Recordset
    Set temprec = CurrentDb.OpenRecordset("SELECT * FROM TEMP;")

    Basically I want to copy everything that is in the table "TEMP" into my recordset so that I can fill variables with the values in "TEMP."

    I currently get an error that tells me that the query must have at least one destination field.

    Do I need to create a querydef first?
    Thanks.

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,739
    closest is DAO (tho mr. gates prefers you to use ADO).

    make sure you have a reference to DAO library
    menu: Tools / References in the code window, then:


    dim dabs as dao.database
    dim recs as dao.recordset
    set dabs = currentdb
    set recs = dabs.openrecordset("SELECT blah blah blah")

    TextBox.value = recs!fieldName

    recs.movenext/first/last,
    recs.edit/.update
    recs.addnew/.update
    recs.EOF/.BOF

    set recs = nothing
    set dabs = nothing

    izy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •