Results 1 to 5 of 5
  1. #1
    JustinC is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    8

    Compile Error: Method or data member not found

    Hi All,




    I am currently trying to learn how to export data from access to excel using vba.
    I am looking at this example www.accessibledatasolutions.com/articles11/AccessToExcel.htm However, when I type out the exact same code I got this error "Compile Error: Method or data member not found" and point to If IsNull(.txtExportPath) Then.


    I would greatly appreciate if anyone can point me and guide me to solve this error.


    Thank You!

  2. #2
    Jim Connell is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2014
    Posts
    4
    The line you're failing on If IsNull(.txtExportPath) requires something to work with.

    If the textbox is left blank you'll get the error you're experiencing.

    Replace the line above with

    If LEN(.txtExportPath &"") <1 then

    Essentially this will test to see if the user has typed anything into the textbox. If not then the user will be asked to enter a path..
    Jim Connell
    Custom Software
    978-392-3462
    http://custom-software.biz
    Home of the Access Wizard

  3. #3
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Not quite.

    From what I can see, I think the error message is telling you that you do not have a control called txtExportPath on your form.

    If you do, try changing .txtExportPath to !txtExportPath.

    It is not supposed to matter, but I have seen cases where Access does get confused between "." and "!", and technically, the "!" should be used when referring to form controls or recordset members.

    John

  4. #4
    JustinC is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    8
    Hi All,

    Thanks for your help. I put a ! in front of txtExportPath and when I compile another error appeared "Compile Error: Sub or Function not defined" and point to RunExcel (strFullName). May I seek your help to solve this error? Thank You!

  5. #5
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    It is because for Access the routine RunExcel does not exist; it is not in the code on the web page.

    Note the following on that web page:


    NOTE: The following code is for demonstration purposes only and is not a complete coding solution.

    The web page does not have all the code you need - it is missing that routine (RunExcel). You will have to try to contact the web page author to get more information.

    John


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

Similar Threads

  1. Replies: 3
    Last Post: 06-27-2014, 01:09 AM
  2. Method or Data member not found error
    By junwatts in forum Access
    Replies: 1
    Last Post: 09-27-2013, 08:49 AM
  3. compile error method or data member not found???
    By chuman vishal in forum Programming
    Replies: 2
    Last Post: 02-26-2013, 01:57 PM
  4. Replies: 7
    Last Post: 06-08-2012, 09:55 PM
  5. Compile Error: Method or data member not found
    By subtilty in forum Programming
    Replies: 5
    Last Post: 02-09-2012, 07:56 AM

Tags for this Thread

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