Method or data member not found

  • Compile error: Method or data member not found.




    Function Print_TestPlan(strTestPlanName As String) --- this is highlighted yellow


    Application.DisplayAlerts = True --- this is highlighted blue


    Ive messed about referencing the DAO object library instead of the access one. Nothing seems to resolve the issue.


    The code I have shown does work for the survey but not the testplan. I have no idea what i can do to fix this now as I've looked at everything I can think of/have come accross searching the internet.


    Could someone help me here?


    This code does work "as is" when run through excel.


    Thanks in advance


    Andy

  • Re: Method or data member not found


    A few things:


    1. Have you declared the ShellExecute API function, and the variable SW_SHOWNORMAL? That is the only thing that causes a compile error if I copy your code and force a compile.


    2. I'm intrigued by your use of DisplayAlerts, although it shouldn't cause a compile error. Your comment says that you are turning off alerts momentarily, but then turns it on. And vice versa when you turn it back on.


    3. Why are you using Functions, and not Subs? Although the code will probably work, the intended use of a function is to return a value, which is not what is happening.

    [COLOR="Purple"]Regards,[/COLOR]
    [COLOR="Purple"]Batman.[/COLOR]

  • Re: Method or data member not found


    Thanks for the replies, hope you had a good weekend.


    Firstly I paid someone a few months ago to make this code, and it runs fine in excel. I cant get hold of the guy now. I do have some limited VBA knowlege but you can probably assume I have none.


    I didnt want to fill up the thread with code that wasnt causing the error but it may help if you see everything.


    This is from the excel document. (without the search functionality for site name)





    In access, I'm using debug print to check the value of the folder its searching and thats working. (this took me a few hours in itself) This is whats assigned to the button click.



    Then this is module2 on the database:


    Code
    Option Compare Database
    Public Const SW_SHOWNORMAL As Long = 1
    Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
      (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
      ByVal lpParameters As String, ByVal lpDirectory As String, _
      ByVal nShowCmd As Long) As Long


    Pike: I'm not 100% how this works but im assuming that value is uupdated when the keyword test is found in that folder.


    Batman:
    1. If thats not declared in the code shown here then no. I wish I could know the answer to the question you ask.
    2. I thought exactally the same, but when it wasnt breaking I just left it like that.
    3. I'm happy to use subs or any method if it works. This is what was supplied to me.



    Note: Even leaving the code exactaly the same (without the folder search.. but with module2) the error remains in access.

  • Re: Method or data member not found


    The Print_TestPlan routine will not work in Access. It has to be in Excel.

    Rory
    Theory is when you know something, but it doesn’t work. Practice is when something works, but you don’t know why. Programmers combine theory and practice: nothing works and they don’t know why

  • Re: Method or data member not found


    The one for the survey does work though and this is also in excel (the majority of the time). Can you sugest a solution or how I might change this? Thanks.

  • Re: Method or data member not found


    Anyone have a sugestion on how I can make this work on a button in access? Happy to do it myself if you could tell me what I'm looking for.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!