Problem with "Dim as Field" 
Author Message
 Problem with "Dim as Field"

Hi,

I use VB4/16 under Win95.

I try to add a field to a TabeleDef.
But I get an error 91 (Object-variable not defined)

I have no problem opening databases and creating recordsets, why can I not
define a new field ?

What is wrong with my code ?

Dim myField as Field
myField.Name = "Name"   <--- error 91
myField.Type = dbtext

...

please CC an e-mail, thx.

T I A
heinz

Heinz Wieczorek   74226 Nordheim   Germany

Out-of-coffee-error at 2 am. System halted.



Fri, 30 Jul 1999 03:00:00 GMT  
 Problem with "Dim as Field"

Quote:

> Hi,

> I use VB4/16 under Win95.

> I try to add a field to a TabeleDef.
> But I get an error 91 (Object-variable not defined)

> I have no problem opening databases and creating recordsets, why can I not
> define a new field ?

> What is wrong with my code ?

> Dim myField as Field
> myField.Name = "Name"   <--- error 91
> myField.Type = dbtext

[chomp]

use Dim myField As New Field (VB3) or CreateField (VB4)

--

WARNING: I cannot be held responsible for the above        They're   coming  to
because  my cats have  apparently  learned to type.        take me away, ha ha!



Tue, 03 Aug 1999 03:00:00 GMT  
 Problem with "Dim as Field"

Quote:

>Hi,

>I use VB4/16 under Win95.

>I try to add a field to a TabeleDef.
>But I get an error 91 (Object-variable not defined)

>I have no problem opening databases and creating recordsets, why can I not
>define a new field ?

>What is wrong with my code ?

>Dim myField as Field
>myField.Name = "Name"   <--- error 91
>myField.Type = dbtext

>....
>T I A
>heinz

Heinz,

Try changing your code to:

Dim myField as New Field
myField.Name = "Name"
myField.Type = dbtext

---------------------------------

The problem is that you declared a variable of type Field but that just sets
up storage for a pointer to a Field object. Using the New keyword creates an
instance of the Field object and sets myField to point to it.

Alternatively, you could separate the Dim and the assign by using the
following code:

Dim myField as Field

Set myField = New Field
.
.
.
----------------------------------

Hope this helps.

-Stu



Thu, 12 Aug 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Problem with "Dim as Field"

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

3. Problem With "window.showmodaldialog("")"

4. "late" DIM statements

5. PROB with "dim as new ADODB...."

6. "Un-dim" Array

7. PROB with "dim as new ADODB...."

8. What is "Dim X%"?

9. PROB with "dim as new ADODB...."

10. VB7 and "Dim WebPublic"

11. Access 2000 "Required" Field Problem

12. Problem accessing field using "!"

 

 
Powered by phpBB® Forum Software