Results 1 to 5 of 5
  1. #1
    joshynaresh is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2013
    Posts
    131

    question about Enumfields

    In this code what is mean by EnumFields. when I insert this code error msg comes as sub of function not defined.
    Code:
    Sub SelectX1()
        Dim dbs As Database, rst As Recordset
    
        ' Modify this line to include the path to Northwind
        ' on your computer.
        Set dbs = OpenDatabase("Northwind.mdb")
    
        ' Select the last name and first name values of all 
        ' records in the Employees table.
        Set rst = dbs.OpenRecordset("SELECT LastName, " _
            & "FirstName FROM Employees;")
    
        ' Populate the recordset.
        rst.MoveLast
    
        ' Call EnumFields to print the contents of the
        ' Recordset.
        EnumFields rst,12
    
        dbs.Close
     End Sub


  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    Enumfields usually refers to the builtin event of a class. Dont use it.
    For a recordset, just cycle thru the recordset yourself...

    Code:
    with rst
      while not .eof()
          vName =  .fields("Name").value 
          debug.print vName
    
          .movenext
      wend
    end with

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    I was unaware of EnumFields and Googled it. Aparently, it is a tool for debugging. It will enumerate a DAO recordset and print it to the Immediate Window.

    So, after "EnumFields rst,12" you can view the result in the Immediate Window. The keyboard shortcut to open the Immediate Window is Ctrl+G.

  4. #4
    joshynaresh is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Aug 2013
    Posts
    131
    how to overcome from error msg "sub or function not defined".


  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Follow advice already given. Don't use EnumFields. VBA is not recognizing. Use the alternative given by ranman in post 2.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 08-25-2012, 07:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums