PC Review


Reply
Thread Tools Rate Thread

CurrentDb( ) Method

 
 
Jason B
Guest
Posts: n/a
 
      28th May 2004
My syntax as follows:

Private Sub cmdFind_Click()
Dim db As Database
Dim rs As Recordset
...

Set db = CurrentDb()
...

When I run this I get User-defined type not defined. The
help files show I have the right syntax but I get this
error. I know that Database isn't a correct type but
that is the why the help files show it also.

Thanks for the help in advance,
Jason B.
 
Reply With Quote
 
 
 
 
Cheryl Fischer
Guest
Posts: n/a
 
      28th May 2004
Do you have a Reference set to the Microsoft DAO 3.6 Object Library? If
you are using Access 2000 or 2002, it is not set by default and without it,
I believe your attempt to Dimension a database object will error.

To check/set References, open any code window (or press Alt-F11). Then,
from the code menu, select Tools|References. Look at the checked
references; and if Microsoft DAO 3.6 Object Library is not one of them,
scroll through the available references and put a check in the box.

In addition, when using Access 2000 and 2002, there is a reference to ADO
which is set by default, so it is necessary to be explicit about how you
want to read data, so you might want to use your code as follows:

> Dim db As DAO.Database
> Dim rs As DAO.Recordset
> ...


> Set db = CurrentDb()


hth,
--

Cheryl Fischer, MVP Microsoft Access



"Jason B" <(E-Mail Removed)> wrote in message
news:1449d01c444da$4b7eb190$(E-Mail Removed)...
> My syntax as follows:
>
> Private Sub cmdFind_Click()
> Dim db As Database
> Dim rs As Recordset
> ...
>
> Set db = CurrentDb()
> ...
>
> When I run this I get User-defined type not defined. The
> help files show I have the right syntax but I get this
> error. I know that Database isn't a correct type but
> that is the why the help files show it also.
>
> Thanks for the help in advance,
> Jason B.



 
Reply With Quote
 
Guest
Posts: n/a
 
      28th May 2004
Thanks that helped out a lot.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using .Execute Method of CurrentDB Object David C. Holley Microsoft Access VBA Modules 9 22nd Jul 2005 08:25 PM
Method Currentdb Kieran Microsoft Access Database Table Design 2 6th Oct 2004 08:30 AM
Error using CurrentDB() method =?Utf-8?B?Sm9obmg=?= Microsoft Access Form Coding 1 20th May 2004 03:18 PM
CurrentDB method problem Lee Microsoft Access VBA Modules 2 23rd Feb 2004 03:38 PM
Any suggestions to fix Method 'CurrentDb' of object '_application' Michael Chipley Microsoft Access 0 2nd Sep 2003 11:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:52 AM.