EnumFields Error 
Author Message
 EnumFields Error

Hi, I am a newbie to VBA for Excel. I am connecting to a database on my
local machine and calling back info. When I run this piece of code which is
copied from an example in help (except I changed paths, etc to match my
database) I get an error at the EnumFields line.

Public Sub try2()
Dim dbs As database, rst As Recordset

    ' Modify this line to include the path to Northwind
    ' on your computer.
    Set dbs = OpenDatabase("c:\mydocu~1\newmrb\newmrb2.mdb")

    ' Select the last name and first name values of all
    ' records in the Employees table.
    ' Set rst = dbs.OpenRecordset("SELECT Date, [P/N], REV, Grade, "
    ' & "[D/C], Quantity, Process, Technology, [Sq Ft] FROM newmrb;")
    Set rst = dbs.OpenRecordset("Select * from newmrb;")

    ' Populate the recordset.
    rst.MoveLast

' Call EnumFields to print the contents of the
' Recordset.
   EnumFields rst, 12

'dbs.Close
End Sub

It says compile error, Sub or Function not defined.

The help is no help. What am I missing? Any ideas would be greatly
appreciated. TIA, Paul



Sat, 04 Aug 2001 03:00:00 GMT  
 EnumFields Error
For your code to work you will need to have a sub or function called
EnumFields somewhere.  Did you perhaps forget to copy the code for
EnumFields from the example?

--
Nustium
(To reply via email remove the obvious from address.)

Quote:

>Hi, I am a newbie to VBA for Excel. I am connecting to a database on my
>local machine and calling back info. When I run this piece of code which is
>copied from an example in help (except I changed paths, etc to match my
>database) I get an error at the EnumFields line.

>Public Sub try2()
>Dim dbs As database, rst As Recordset

>    ' Modify this line to include the path to Northwind
>    ' on your computer.
>    Set dbs = OpenDatabase("c:\mydocu~1\newmrb\newmrb2.mdb")

>    ' Select the last name and first name values of all
>    ' records in the Employees table.
>    ' Set rst = dbs.OpenRecordset("SELECT Date, [P/N], REV, Grade, "
>    ' & "[D/C], Quantity, Process, Technology, [Sq Ft] FROM newmrb;")
>    Set rst = dbs.OpenRecordset("Select * from newmrb;")

>    ' Populate the recordset.
>    rst.MoveLast

>' Call EnumFields to print the contents of the
>' Recordset.
>   EnumFields rst, 12

>'dbs.Close
>End Sub

>It says compile error, Sub or Function not defined.

>The help is no help. What am I missing? Any ideas would be greatly
>appreciated. TIA, Paul



Sun, 05 Aug 2001 03:00:00 GMT  
 EnumFields Error
Strangely enough for a compiler message, it means exactly what it says: "Sub
or Function not defined." The line "EnumFields rst, 12" is a call to a
subroutine (sub) or function named EnumFields with parameters rst and 12.
EnumFields is not an intrinsic VBA subroutine or function so it's user
defined, which means you have to write the code yourself. The example should
have included an EnumFields Sub or Function. Paste that in your code.

Peter Mundy


Quote:
>Hi, I am a newbie to VBA for Excel. I am connecting to a database on my
>local machine and calling back info. When I run this piece of code which is
>copied from an example in help (except I changed paths, etc to match my
>database) I get an error at the EnumFields line.

>Public Sub try2()
>Dim dbs As database, rst As Recordset

>    ' Modify this line to include the path to Northwind
>    ' on your computer.
>    Set dbs = OpenDatabase("c:\mydocu~1\newmrb\newmrb2.mdb")

>    ' Select the last name and first name values of all
>    ' records in the Employees table.
>    ' Set rst = dbs.OpenRecordset("SELECT Date, [P/N], REV, Grade, "
>    ' & "[D/C], Quantity, Process, Technology, [Sq Ft] FROM newmrb;")
>    Set rst = dbs.OpenRecordset("Select * from newmrb;")

>    ' Populate the recordset.
>    rst.MoveLast

>' Call EnumFields to print the contents of the
>' Recordset.
>   EnumFields rst, 12

>'dbs.Close
>End Sub

>It says compile error, Sub or Function not defined.

>The help is no help. What am I missing? Any ideas would be greatly
>appreciated. TIA, Paul



Sun, 05 Aug 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Compile error: Automation error, Error 32811: Unexpected error

2. Compilation error: Automation Error (Error 440)

3. ERROR Code 0x80004005 : ERROR Code 0xfee670 : ERROR 1157

4. Run-time error '-2147417846 (8001010a)': Automation error (error 440)

5. Crystal error: error ocurred reading records: error in compiling sql expression

6. Error 20639: SQL Expression error - Error in creating SQL Expression COM Parser (cpeaut32)

7. Run-time error '-2147417846 (8001010a)': Automation error (error 440)

8. Error message: Error accessing file

9. Access97, Win95 Error 76 Path error 99

10. ERROR HANDLERS RUNNING WITHOUT ERRORS

11. Access ACC2000:Error Message: Error Accessing File

12. Error 3043: "Disk or Network error"

 

 
Powered by phpBB® Forum Software