Public Type -- Getting error 
Author Message
 Public Type -- Getting error

in module1.bas I have the following (from help) that I made public.

Public Type EmployeeRecord   ' Create user-defined type.
   ID As Integer   ' Define elements of data type.
   Name As String * 20
   Address As String * 30
   Phone As Long
   HireDate As Date
End Type

-------------------------------
From form1 I have the following (from help)

Sub CreateRecord()
   Dim MyRecord As EmployeeRecord   ' Declare variable.

   ' Assignment to EmployeeRecord variable must occur in a procedure.
   MyRecord.ID = 12003   ' Assign a value to an element.
End Sub

---------------------------------
When I call CreateRecord within form load, I get a error
user-defined type not defined (at Dim MyRecord As EmployeeRecord   ' Declare
variable)

If everything is in form1, it works. What am I doing wrong?

Gary...



Sat, 04 Oct 2003 00:43:40 GMT  
 Public Type -- Getting error
Dumb error!!!

I defined Type after a function definition. VB did not warn me, It just

ignored the definition.

Gary...


Quote:
> in module1.bas I have the following (from help) that I made public.

> Public Type EmployeeRecord   ' Create user-defined type.
>    ID As Integer   ' Define elements of data type.
>    Name As String * 20
>    Address As String * 30
>    Phone As Long
>    HireDate As Date
> End Type

> -------------------------------
> From form1 I have the following (from help)

> Sub CreateRecord()
>    Dim MyRecord As EmployeeRecord   ' Declare variable.

>    ' Assignment to EmployeeRecord variable must occur in a procedure.
>    MyRecord.ID = 12003   ' Assign a value to an element.
> End Sub

> ---------------------------------
> When I call CreateRecord within form load, I get a error
> user-defined type not defined (at Dim MyRecord As EmployeeRecord   '
Declare
> variable)

> If everything is in form1, it works. What am I doing wrong?

> Gary...



Sat, 04 Oct 2003 01:08:56 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Public Type vs. Public variable() as Double

2. Passing Public user-defined types via Public Functions

3. Error using user-defined type in parameter of public procedure in a class module

4. public user defined type error

5. Public Type COmpile Error

6. Getting a Compile Error: ByRef argument type mismatch

7. Help: Getting Type Mismatch error when OpenRecordSet of new database

8. Getting data type conversion error

9. Getting the basic [Type] of an array [Type[]]

10. getting to public folder with vb

11. Getting Status Update from a COM server thru public members

12. Help getting to a Public Folder using the Fodler ID

 

 
Powered by phpBB® Forum Software