Access 97 VBA v Access 2K VBA - different ? 
Author Message
 Access 97 VBA v Access 2K VBA - different ?

Hi there,

I've got a MS Access 97 DB with 100,000 lines of VBA code.
I have converted it to MS Access 2K and everything went
fine. However, when compiling the DB I get error messages
that point to public functions that I've created. The
message says that the type needs to be declared.

Since I didn't have this problem before, I am not too sure
what to do.

I've got 2 questions, a) where can I find out what has
changed in terms of VBA between the two versions and b) is
there a quick answer to the above problem?

Thanks in advance.

Regards
Michael



Sat, 04 Dec 2004 09:26:16 GMT  
 Access 97 VBA v Access 2K VBA - different ?
Michael:

I wish you had given an example line of code that was rejected.  

 Could it simply be the fact that A2K does not include DAO whereas A97
includes it by default?

Richard



Quote:
>Hi there,

>I've got a MS Access 97 DB with 100,000 lines of VBA code.
>I have converted it to MS Access 2K and everything went
>fine. However, when compiling the DB I get error messages
>that point to public functions that I've created. The
>message says that the type needs to be declared.

>Since I didn't have this problem before, I am not too sure
>what to do.

>I've got 2 questions, a) where can I find out what has
>changed in terms of VBA between the two versions and b) is
>there a quick answer to the above problem?

>Thanks in advance.

>Regards
>Michael



Sat, 04 Dec 2004 10:23:46 GMT  
 Access 97 VBA v Access 2K VBA - different ?
Hi Richard,

Thanks for your reply.

Re sample code, it seems all public functions are rejected.
But I will check your DAO suggestion.

Thanks a lot in the mean time.

Cheers
Michael

Quote:
>-----Original Message-----
>Michael:

>I wish you had given an example line of code that was
rejected.  

> Could it simply be the fact that A2K does not include
DAO whereas A97
>includes it by default?

>Richard

>On Mon, 17 Jun 2002 18:26:16 -0700, "Michael W."


Quote:

>>Hi there,

>>I've got a MS Access 97 DB with 100,000 lines of VBA
code.
>>I have converted it to MS Access 2K and everything went
>>fine. However, when compiling the DB I get error
messages
>>that point to public functions that I've created. The
>>message says that the type needs to be declared.

>>Since I didn't have this problem before, I am not too
sure
>>what to do.

>>I've got 2 questions, a) where can I find out what has
>>changed in terms of VBA between the two versions and b)
is
>>there a quick answer to the above problem?

>>Thanks in advance.

>>Regards
>>Michael

>.



Sun, 05 Dec 2004 10:08:21 GMT  
 Access 97 VBA v Access 2K VBA - different ?
When all public functions are rejected, it means that
you have a problem with your 'references'. See any
message in this thread with the word 'references' in the
text.

(david)

Quote:

> Hi Richard,

> Thanks for your reply.

> Re sample code, it seems all public functions are rejected.
> But I will check your DAO suggestion.

> Thanks a lot in the mean time.

> Cheers
> Michael

> >-----Original Message-----
> >Michael:

> >I wish you had given an example line of code that was
> rejected.

> > Could it simply be the fact that A2K does not include
> DAO whereas A97
> >includes it by default?

> >Richard

> >On Mon, 17 Jun 2002 18:26:16 -0700, "Michael W."


> >>Hi there,

> >>I've got a MS Access 97 DB with 100,000 lines of VBA
> code.
> >>I have converted it to MS Access 2K and everything went
> >>fine. However, when compiling the DB I get error
> messages
> >>that point to public functions that I've created. The
> >>message says that the type needs to be declared.

> >>Since I didn't have this problem before, I am not too
> sure
> >>what to do.

> >>I've got 2 questions, a) where can I find out what has
> >>changed in terms of VBA between the two versions and b)
> is
> >>there a quick answer to the above problem?

> >>Thanks in advance.

> >>Regards
> >>Michael

> >.



Tue, 07 Dec 2004 09:46:27 GMT  
 Access 97 VBA v Access 2K VBA - different ?
I had this problem too.  My 97 code was declared as so:
    Dim db as Database
    Dim rs as Recordset

That was not accepted.

    Really declare it:  Dim db as DAO.Database
                               Dim rs as DAO.Recordset

Fixed my problem.


Quote:
> Hi there,

> I've got a MS Access 97 DB with 100,000 lines of VBA code.
> I have converted it to MS Access 2K and everything went
> fine. However, when compiling the DB I get error messages
> that point to public functions that I've created. The
> message says that the type needs to be declared.

> Since I didn't have this problem before, I am not too sure
> what to do.

> I've got 2 questions, a) where can I find out what has
> changed in terms of VBA between the two versions and b) is
> there a quick answer to the above problem?

> Thanks in advance.

> Regards
> Michael



Mon, 13 Dec 2004 00:44:05 GMT  
 Access 97 VBA v Access 2K VBA - different ?


Quote:
> I had this problem too.  My 97 code was declared as so:
>     Dim db as Database
>     Dim rs as Recordset

> That was not accepted.

>     Really declare it:  Dim db as DAO.Database
>                                Dim rs as DAO.Recordset

> Fixed my problem.

This is because Access references ADO as default. To use DAO you must
explicitly reference the DAO library using Tools > References.

If both libraries are referenced, objects common to both of them (like
Recordset, but not like Database) will refer either to the first one in the
list, or to the one you explicitly declare with DAO.Recordset or
ADODB.Recordset.

HTH

Tim F



Mon, 13 Dec 2004 05:26:06 GMT  
 Access 97 VBA v Access 2K VBA - different ?


Quote:
> I had this problem too.  My 97 code was declared as so:
>     Dim db as Database
>     Dim rs as Recordset

> That was not accepted.

>     Really declare it:  Dim db as DAO.Database
>                                Dim rs as DAO.Recordset

> Fixed my problem.

This is because Access 2000 + (unlike Access 97) references ADO as default.
To use DAO you must explicitly reference the DAO library using Tools >
References.

If both libraries are referenced, objects common to both of them (like
Recordset, but not like Database) will refer either to the first one in the
list, or to the one you explicitly declare with DAO.Recordset or
ADODB.Recordset.

HTH

Tim F



Mon, 13 Dec 2004 05:30:07 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Access 2000 VBA Handbook vis a vis Access 97 VBA Handbook

2. VBA 97 to VBA 2K/2002/2003

3. Access 97: VBA-DAO-Access 97 synchronization problem?

4. ACCESS VBA - why different from other vba?

5. Access 97 VBA modifications not visible in Access 2000

6. Using VBA to Convert Access 2000 database to Access 97

7. vba access 97 -> access 2000

8. VBA OpenDatabase: Access 97 <-> Access 2000

9. Converting Access 97 to Access 2000 via VBA

10. SOAP access from VBA in Access 97 ?

11. vba code to copy table from access 97 to excel 97

12. VBA mailmerge problem in 2K vs 97

 

 
Powered by phpBB® Forum Software