What is the difference between CurrentProject and CodeProject?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've read the documentation for both objects and I think I'm getting hung up
on the phrase "code database". I 'm not sure what a "code database" is.
 
Hi, Ashwin.
I've read the documentation for both objects and I think I'm getting hung
up
on the phrase "code database". I 'm not sure what a "code database" is.

The "code" database is the library database. It's used to differentiate the
library database's objects and functions from the current database's objects
and functions when code is called from the current database. For example,
if you want to open a Recordset Object in the library database, just typing
the following line of code in the library database will ensure that the
Recordset will be opened in the current database, not the library database:

Set recSet = CurrentDb().OpenRecordset ("LibraryQueryName")

Unless a query of the same name exists in the database that references the
library database, this will cause a run time error. (Even if a query with
the same name exists in the database referencing the library database, then
there's no run time error, but no guarantee it retrieves the same data set
so it could cause logic errors, which are bugs that can be very difficult to
track down.) Therefore, the library database needs to be referenced in the
code, so that Access can look for the query in the library database and use
it for the Recordset Object's data source:

Set recSet = CodeDb().OpenRecordset ("LibraryQueryName")

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact
info.
 
ashwin said:
I've read the documentation for both objects and I think I'm getting hung up
on the phrase "code database". I 'm not sure what a "code database" is.


CodeProject is the project that contains the line of code
that used CodeProject. This can be different from
CurrentProject only when you are using an Access database as
a library for the CurrentProject database.
 
Back
Top