Results 1 to 4 of 4
  1. #1
    nello87to is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Aug 2016
    Posts
    14

    problem reading table from VB code

    Hello,


    i am trying to read a table defined in an access project with a vb module but i have this kind of error:

    Click image for larger version. 

Name:	errore.png 
Views:	18 
Size:	31.9 KB 
ID:	25467
    This is the error: User-defined type not defined
    I have found this code online and i have adapted it for my function.
    Someone know if i must define something else to read fields from a table?

    thank you all


  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    i occasionally get this error, so do this....
    dont define rst as recordset, instead use variant then open rst using openrecordset command....

    Code:
    dim rst 
    
    set rst = currentdb.openrecordset(sql)

  3. #3
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I have never used ADO, only DAO. But I did find a couple of pages that might help:
    https://www.aspfree.com/c/a/Microsof...cess-with-ADO/
    https://www.aspfree.com/c/a/Microsof...ccess-and-ADO/


    Do you have a reference set to "Microsoft ActiveX Data Objects 2.8 Library"??

  4. #4
    nello87to is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Aug 2016
    Posts
    14
    It works using variant and openrecordset command.
    I didn't have set the reference "Microsoft ActiveX Data Objects 2.8 Library".
    Probably this was the problem. Next time i will try setting this reference.

    thank you all
    and good work!

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

Similar Threads

  1. Replies: 5
    Last Post: 02-09-2015, 04:18 PM
  2. Replies: 5
    Last Post: 12-15-2014, 03:34 AM
  3. need help with reading code in downloaded file
    By ringnalda506 in forum Access
    Replies: 2
    Last Post: 12-03-2013, 11:32 AM
  4. Reading VBA code
    By ksammie01 in forum Access
    Replies: 11
    Last Post: 01-11-2013, 03:40 PM
  5. Control Source on Form Reading Value in Table
    By hammer187 in forum Forms
    Replies: 1
    Last Post: 10-23-2012, 02:43 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