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 / General 2 / June 2007

Tip: Looking for answers? Try searching our database.

The DAO that can be spoken of is not the DAO

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Stapes - 14 Jun 2007 14:47 GMT
Hi

If I state in my VB:

Dim blah DAO.Database, does that make it a DAO Database, or is it DAO
anyway?

Stapes
Rick Brandt - 14 Jun 2007 14:51 GMT
> Hi
>
[quoted text clipped - 4 lines]
>
> Stapes

As far as I know DAO is the only library that has a Database object so you
don't need the prefix.  Those that use the prefixes often just prefer to use
them everywhere for the sake of clarity and/or consistency.

Signature

Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com

Norman Yuan - 14 Jun 2007 15:44 GMT
I am not very sure what you really want to know. Here is my answer to yuor
question literally:

Dim blah As DAO.Database

means:

You want VB to create a variable, which is a pointer/reference, in the
memory, in order to refer to an object stored in memory somewhere later. In
this case, this pointer/reference can only be used to point/refer to a
DAO.Database object, nothing else. However "Dim" the variable, does not
create/make anything, it just sits in memory and points/referes to nowhere,
meaning it is "Nothing" at this point of time, and it is cleared out from
memory when out of scope, whether the real object it pointed to is still
alife or not.

> Hi
>
[quoted text clipped - 4 lines]
>
> Stapes
George Nicholson - 14 Jun 2007 18:08 GMT
The ADO and DAO object libraries share some object names, (Recordsets being
the 100 lb elephant), so its important to specify which type you want in
those cases (aka, disambiguate the reference). Since the Database object
only appears in DAO, I guess it's a matter of personal habit/consistency to
explicitly declare *any* member of ADO/DAO libraries as such, rather than
just the objects that 'need' to be. IMHO, it helps to keep things straight
in my mind as the code is being written *or maintained*.

In other words, *if* you have a reference to the DAO object librbary set,
then "Dim rs as Database" would automatically refer to a DAO database
*unless* you also had a reference to some other object library that also
included a Database object (and I have no idea what that would be). Without
a DAO object library reference, that declaration would generate a compile
error. (Exception: I believe DAO is "built into" Access 2007, so it doesn't
require a separate reference.)

HTH,

> Hi
>
[quoted text clipped - 4 lines]
>
> Stapes
 
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.