Results 1 to 8 of 8
  1. #1
    Join Date
    Mar 2002
    Location
    Denver, CO
    Posts
    3

    Question Unanswered: using adh_accGetFileName

    I use this function in several places in a particular app that I'm writing; in one place, it works just fine; in another, it returns error code 301, meaning "Failure". The parameters I'm plugging into the passed data structure are:

    .hWndOwner = Application.hWndAccessApp
    .strAppName = "Object Librarian"
    .strDialogTitle = "OL Browse File"
    .strOpenTitle = "Select"
    .strOpenFIle = ""
    .strFilter = "*.pro"
    .strInitialDir = "c:\"
    .lngFlags = adhcGfniNoChangeDir

    (a subroutine called takes care of null terminations.) What is causing the 301 exit code?

  2. #2
    Join Date
    Oct 2001
    Location
    Bay Area, CA
    Posts
    117
    You are using a function that probably comes form a CD that came with a book. I believe adh_..etc stands for Access Developers Handbook. You need to use your debug feature to scroll through your code and see where it stalls. Otherwise, give us the adh_function code so people on this site can assess where and why the error occurs.

  3. #3
    Join Date
    Mar 2002
    Location
    Denver, CO
    Posts
    3
    Right you are. The defininition for the call is:

    Declare Function adh_accOfficeGetFileName Lib "msaccess.exe" _
    Alias "#56" (gfni As adh_accOfficeGetFileNameInfo, ByVal fOpen As Integer) As Long

    Following it with the debugger doesn't help too much because it doesn't hang, it simply returns 301.

    Thanks for your help.

  4. #4
    Join Date
    Oct 2001
    Location
    Bay Area, CA
    Posts
    117
    so this could mean that the function cannot find adh_accGetFileName
    It has to be a function within the same database, or in a linked DLL or something.

    You mentioned that the function works elsewhere. In another DB?

  5. #5
    Join Date
    Mar 2002
    Location
    Denver, CO
    Posts
    3
    I presume it is an api in msaccess.exe. It's function is to display and handle an open file dialog popup. I call it in reponse to a form's Browse button click. The other call I mentioned is called from another such button on a different form in the same app; the only difference is that it has a flag set that indicates the form is for directory, not file, determination.

  6. #6
    Join Date
    Oct 2001
    Location
    Bay Area, CA
    Posts
    117
    No, you are using a local funcion created by the ADH folks and this function references the access.lib.

    You should use you debug feature to scroll through the code and see why is stalls.

    Your current settings are to look for .pro files, starting the in the c:\ root.

    I ran one of the handbook tests and it doesn't seem to check for directories, only files.

    Hope this helps...

  7. #7
    Join Date
    Nov 2001
    Posts
    336
    Try code post here:

    http://mvps.org/access/api/api0001.htm

    It works fine.

  8. #8
    Join Date
    Oct 2001
    Location
    Bay Area, CA
    Posts
    117
    Yes sir, the duy who developed that code was also a contributor to the Access Developer Handbook.

    The code is similar and does the same.

    Lmc might find the missing piece there. Though it won't find any directories.

    LMC, if you need a directory, select a file in the directory and cut off the file name, and you have the directory path left.

    Hope this helps....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •