Dim 
Author Message
 Dim

Does anyone know the key to when to use the following
statements:

    Dim Table1 As DAO.Recordset
    Dim Table2 As DAO.Recordset
    Dim MyDB As DAO.Database

    Set MyDB = CurrentDb
    Set Table1 = MyDB.OpenRecordset("Travel Table")
    Set Table2 = MyDB.OpenRecordset("Budget Table")

I use the above statements in a module and they work just
fine.  I tried to use same (except names changed) in
another database and get the following error when I try to
compile the module.

Any help would be greatly appreciated.  Thanks in advance.
Ken



Sun, 18 Jan 2004 01:12:30 GMT  
 Dim
And what would "the following error" be?

If it's a compile error, I would suspect that you don't have the DAO reference set in the database. Compare Tools / References in
the two databases.

--

Sco

M.L. "Sco" Scofield, MCSD, MCT, MCP, MSS
Useful Metric Conversion #11 of 19: 100 rations = 1 C-ration
Miscellaneous Access and VB "stuff" at www.ScoBiz.com

Quote:

> Does anyone know the key to when to use the following
> statements:

>     Dim Table1 As DAO.Recordset
>     Dim Table2 As DAO.Recordset
>     Dim MyDB As DAO.Database

>     Set MyDB = CurrentDb
>     Set Table1 = MyDB.OpenRecordset("Travel Table")
>     Set Table2 = MyDB.OpenRecordset("Budget Table")

> I use the above statements in a module and they work just
> fine.  I tried to use same (except names changed) in
> another database and get the following error when I try to
> compile the module.

> Any help would be greatly appreciated.  Thanks in advance.
> Ken



Sun, 18 Jan 2004 01:32:53 GMT  
 Dim
Hi ,

My name is Kathy Swallow. Thank you for using the Microsoft Access
Newsgroups.

Your post does not say what error message you are getting so I'm taking a
stab in the dark on this one. :)  Based on the code you provided, it may be
that the machine giving the error does not have DAO registered or
referenced correctly. Here are the steps to ensure DAO is registered
correctly on the problem machine:

1/Go to Start/Find/Files or Folders
2/Search for both regsvr32.exe and dao360.dll (separated by a comma)
3/Highlight the dao360.dll file that was found and drag and drop it on top
of the regsvr32.exe file that was found.
4/A message saying that "dllregserver in c:\......succeeded" should appear.
5/Go back in to access and open up your database. Then open the VB editor.
6/ Go to Tools/References and make sure you have a reference to Microsoft
DAO 3.6 Object Library.
7/Try compiling your code.

If the above does not resolve the issue, please post the text of the error
message you are receiving.

I hope this helps! If you have additional questions on this topic, please
reply to this posting.

Regards, Kathy Swallow
Microsoft Support

The Microsoft Knowledge Base has a great search engine where you can search
for solutions to problems by keywords. You may find this useful in the
future:

Q242971 HOWTO: Use the Developer Support Microsoft Knowledge Base
http://support.microsoft.com/support/kb/articles/q242/9/71.asp



Sun, 18 Jan 2004 20:59:57 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. dim string to dim form

2. Newbie Question: Dim A() as String /Dim A as String()

3. Dim obj As New Class crt Dim Obj As Class = New Class

4. dynamically dim a variable ie dim "variable"&n

5. dim myObject as Object versus dim myObject as myProject.class1

6. dim myObject as Object versus dim myObject as myProject.class1

7. Any difference between DIM....as NEW and DIM....as....= NEW.....?

8. QB45: difference between DIM a$(20) and DIM a(20) AS STRING?

9. IS there a way to dim and assign values with a single dim statement?

10. Dim dbs As Database generates error

11. Dim'ing a list of variables

12. Problem dimming a variable as a database!

 

 
Powered by phpBB® Forum Software