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.
Conrad - 07 Dec 2005 15:36 GMT
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.
> Hi,
>
[quoted text clipped - 4 lines]
> works but seems to be a bit of an odd way to go about it.
> Thanks in advance.
Dirk - 07 Dec 2005 21:28 GMT
So if I understand this correctly: adOpenKeyset assures that the recordset
will not be loaded with the table's contents, only it's structure?
> The easiest way is to do the following.
>
[quoted text clipped - 13 lines]
> > works but seems to be a bit of an odd way to go about it.
> > Thanks in advance.
Tim Ferguson - 07 Dec 2005 16:34 GMT
> 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
Dirk - 07 Dec 2005 21:30 GMT
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.
> > However, I would like to open
> > an empty tecordset based on an access table
[quoted text clipped - 6 lines]
>
> Tim F