Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / December 2005

Tip: Looking for answers? Try searching our database.

Empty ADO recordset based on a table for writing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dirk - 07 Dec 2005 14:56 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.