Very newbie problem with Object Error (Error 424) 
Author Message
 Very newbie problem with Object Error (Error 424)

I am having a (i assume) very simple problem.  I'm a UNIX/C++, delphi
programmer doing a project in VB 4.0 (16bit).  I am trying to get the
following
code snippet to work in VB with a persistent Object error.  I admit, I'm a
VB
newbie but this doesn't compute...

in a module..

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

this consistently says "Object Required" on the second line (Set sDbName).
I'd really like to set the sDbName as a global so I don't have to hardcode
the
name of the DB everytime a form needs it.

Any help appreciated.

-darrel
--
--------------------------------------------------------------


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



Wed, 24 Feb 1999 03:00:00 GMT  
 Very newbie problem with Object Error (Error 424)

Quote:

> I am having a (i assume) very simple problem.  I'm a UNIX/C++, Delphi
> programmer doing a project in VB 4.0 (16bit).  I am trying to get the
> following
> code snippet to work in VB with a persistent Object error.  I admit, I'm a
> VB
> newbie but this doesn't compute...

> in a module..

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

> this consistently says "Object Required" on the second line (Set sDbName).
> I'd really like to set the sDbName as a global so I don't have to hardcode
> the
> name of the DB everytime a form needs it.

> Any help appreciated.

> -darrel

Sounds that you forgot to add the DAO control to your project.

Karlheinz



Fri, 26 Feb 1999 03:00:00 GMT  
 Very newbie problem with Object Error (Error 424)


 > Dim sDbName As String * 128
 > Set sDbName = "F:\VBASIC\AFAX0727.MDB"
 > Set avfDb = DBEngine.Workspaces(0).OpenDatabase(sDbName)
 >
 > this consistently says "Object Required" on the second line (Set
sDbName).

You are using set on a string variable.  Set is only used on an object
variable.  Should be

sDbName = "F:\VBASIC\AFAX0727.MDB"

Neal



Fri, 26 Feb 1999 03:00:00 GMT  
 Very newbie problem with Object Error (Error 424)

Yes, that may also be a problem (I mean that the reference to the DAO
control is missing), besides that the string sDbName should not be set to
a value with "set". Take a look below; (it works!)

    Dim sDbName As String * 128
    Dim avfDb As Database

    sDbName = "f:\dbdir\unknown.mdb"      ' DON'T use "set"
    Set avfDb = DBEngine.Workspaces(0).OpenDatabase(sDbName)

Good Luck!

       /  magnus



Mon, 01 Mar 1999 03:00:00 GMT  
 Very newbie problem with Object Error (Error 424)

Quote:

> I am having a (i assume) very simple problem.  I'm a UNIX/C++, Delphi
> programmer doing a project in VB 4.0 (16bit).  I am trying to get the
> following
> code snippet to work in VB with a persistent Object error.  I admit, I'm a
> VB
> newbie but this doesn't compute...

> in a module..

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

> this consistently says "Object Required" on the second line (Set sDbName).
> I'd really like to set the sDbName as a global so I don't have to hardcode
> the
> name of the DB everytime a form needs it.

> Any help appreciated.

> -darrel
> --
> --------------------------------------------------------------


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

You won't believe this but skip the set.

Just type:

sDbName = mystring

Also. I don't advise a fixed length string.

See help file

String Data Type
There are two kinds of strings:

        Variable-length strings, which can contain up to approximately 2
billion (2^31) characters (approximately 64K (2^16) characters
for Microsoft Windows version 3.1 and earlier).  
        Fixed-length strings, which can contain 1 to approximately 64K (2^16)
characters.  

Note   Public fixed-length strings can't be used in class modules.

GD
--

 +-----------------------------------------------+
 | Guillaume Dery                                |
 | Junior Systems Analyst                        |
 | Government Telecomm. and Informatics Services |

 +-----------------------------------------------+



Mon, 01 Mar 1999 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Automation error... Error 424, Object Required

2. Error Starting application executable (error 424 - Object required)

3. run-time error 424 object required

4. Run-time error '424': Object required

5. Runtime error 424: Object required

6. Error 424 Object Required

7. Run-Time error '424': object Required

8. Clipboard.Clear - Returns Error 424 - Object Required

9. Runtime Error 424 Missing Object

10. Run-Time Error 424, Object-Required.

11. Object required (Error 424)

12. runtime error 424 object required

 

 
Powered by phpBB® Forum Software