Empty ADO recordset based on a table for writing

D

Dirk

Hi,

I have seen a lot of good examples where one would open a recordset by
running a query and then add or change records. However, I would like to open
an empty tecordset based on an access table. Is there a nice way to do this
without having it run a query you know will return 0 results? That trick
works but seems to be a bit of an odd way to go about it.
Thanks in advance.
 
C

Conrad

The easiest way is to do the following.

Dim rst as New ADODB.Recordset

rstGLClass.Open "MyTable", CurrentProject.Connection, adOpenKeyset,
adLockOptimistic

And then you off and running.
 
T

Tim Ferguson

However, I would like to open
an empty tecordset based on an access table

SELECT FieldOne, FieldTwo, FieldThree
FROM MyTable
WHERE FALSE;


Hope that helps


Tim F
 
D

Dirk

So if I understand this correctly: adOpenKeyset assures that the recordset
will not be loaded with the table's contents, only it's structure?
 
D

Dirk

Thanks. However that is the workaround I have been using so far. Seemed
logical that there was a "clean" way to do this though. I hope Conrad's
solution does the job.
 
Top