×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Urgent - What does Set db = DbEngine(0)(0) mean???

Urgent - What does Set db = DbEngine(0)(0) mean???

Urgent - What does Set db = DbEngine(0)(0) mean???

(OP)
I was having a problem turning off system messages when I was running a action query.

Some one from one of the access news groups told me to use:
Dim Db as DAO.Database
Set db = DbEngine(0)(0)

db.Execute ("NameOfYourQuery")

Are the first 2 lines safe because since using it, access 2k cant find ANY of my querys that I call from code??????

Thanks

Jo

RE: Urgent - What does Set db = DbEngine(0)(0) mean???

Hi,
 You a setting a referrence to the first database in the first workspace of the database engine's work spaces collection. "Set db = CurrentDB" will do the same thing. In the first line you are declaring a variable of type DAO.Database. The next line you are setting that variable to referrence the current database. Perfectly safe! However, if you don't understand this code, try simply doing this:

DoCmd.RunSQL "X"

where X is the name of a query or an embedded SQL statement.

Rob Marriott
CCTC1
rob@career-connections.net

RE: Urgent - What does Set db = DbEngine(0)(0) mean???

you could also lose the dbengine(0)(0) code completly and use :-

original....

dim db as database
set db = dbengine(0)(0)
db.execute("Name of Your Query")


shorter....


currentdb().execute("Name of Your Query")


currentdb() is a function which effectively does the dbengine(0)(0) part for you, which is to return a pointer to the current database.

The (0)(0) would change to other numbers only if you were trying to access linked databases.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close