If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back  dBforums > PC based Database Applications > Microsoft Access > CurrentDB.OpenRecordset()

LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Registered User
Join Date: Aug 2003
Posts: 3

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?
Reply With Quote
  #2 (permalink)  
Cavalier King Charles
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


set recs = nothing
set dabs = nothing

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On