Newbie having trouble with Object Error 
Author Message
 Newbie having trouble with Object Error

I'm a newbie to VB and am having a problem with the following code.

    Dim sDbName As String * 128
    Set sDbName = "F:\VBASIC\AFAX0727.MDB"
    Set avfDb = DBEngine.Workspaces(0).OpenDatabase(sDbName)

I always get an Object Error (Error 424) on the second line.  I would
really
like to assign the DB name globally so I don't have to enumerate it every
time
or use a ReadProfileString every where a form needs it.  BTW, this is in a
non-form module.  What am I doing wrong?

thanks,
-darrel
--
--------------------------------------------------------------


*   ThunderWave, Inc.                                        *
--------------------------------------------------------------



Wed, 24 Feb 1999 03:00:00 GMT  
 Newbie having trouble with Object Error

Set is used to assign an Object variable (Form, Control, Database,
Recordset, etc.). To assign "regular" variables (strings, integers,
etc.), remove the Set.

  Dim sDbName As String * 128
  Dim avfDb As Database
  sDbName = "F:\VBASIC\AFAX0727.MDB"
  Set avfDb = DBEngine.Workspaces(0).OpenDatabase(sDbName)

Quote:

> I'm a newbie to VB and am having a problem with the following code.

>     Dim sDbName As String * 128
>     Set sDbName = "F:\VBASIC\AFAX0727.MDB"
>     Set avfDb = DBEngine.Workspaces(0).OpenDatabase(sDbName)

> I always get an Object Error (Error 424) on the second line.  I would
> really
> like to assign the DB name globally so I don't have to enumerate it every
> time
> or use a ReadProfileString every where a form needs it.  BTW, this is in a
> non-form module.  What am I doing wrong?

> thanks,
> -darrel
> --
> --------------------------------------------------------------


> *   ThunderWave, Inc.                                        *
> --------------------------------------------------------------

--
Karl Costenbader, President
Competent Consulting
Sacramento, CA

Home Page: http://www.competent.com


Wed, 24 Feb 1999 03:00:00 GMT  
 Newbie having trouble with Object Error


Quote:
>I'm a newbie to VB and am having a problem with the following code.

>    Dim sDbName As String * 128
>    Set sDbName = "F:\VBASIC\AFAX0727.MDB"
>    Set avfDb = DBEngine.Workspaces(0).OpenDatabase(sDbName)

>I always get an Object Error (Error 424) on the second line.  I would
>really
>like to assign the DB name globally so I don't have to enumerate it every

your problem is that you dim as a string instead of as a database

Dim  sDbName As Database



Sat, 27 Feb 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Newbie having trouble with VBA Code in Access

2. A Newbie having trouble passing variables from one sup-procedure to another

3. Newbie Having trouble with this User Info script, Please help

4. Having trouble sending multiple emails using outlook object

5. Having trouble copying an object

6. Having trouble saving array in Session object

7. Having trouble passing object to a sub procedure

8. getting reference path errors, having trouble fixing.

9. Very newbie problem with Object Error (Error 424)

10. Having Trouble populating an array from table values

11. Having trouble programatically switching between fax and pdf report output

12. Having Trouble w/Data Validation Code (Acc97)

 

 
Powered by phpBB® Forum Software