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()

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
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.
Reply With Quote
  #2 (permalink)  
Old
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

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

set recs = nothing
set dabs = nothing

izy
Reply With Quote
Reply

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