Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2012
    Posts
    4

    Unanswered: API: Call the standard Windows File Open/Save dialog box - Ambiguous Name Detected

    Hi,

    I am trying to create a command button on my form, which allows the user to open and browse for a file, and then store the specific file path into the table.

    After extensive googling, many forums point to:
    API: Call the standard Windows File Open/Save dialog box for this function.

    I tried applying this to my database, but keep receiving the error:
    "Ambiguous name detected: ~"

    I pasted the the whole chunk of code into a module, the followinging into the onclick event of my Browse Button:

    Private Sub cmdBrowseDrawing_Click()

    Dim strFilter As String
    Dim strInputFileName As String

    strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)", "*.XLS")
    strInputFileName = ahtCommonFileOpenSave( _
    Filter:=strFilter, OpenFile:=True, _
    DialogTitle:="Please select an input file...", _
    Flags:=ahtOFN_HIDEREADONLY)

    Me.dDrawingLink = strInputFileName
    'Me.dDrawingLink is a bounded textbox on my form where the filepath should be stored

    End Sub

    Could someone kindly point out where I've made the mistake? Any help would be greatly appreciated!

    -Cai Shan

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Quote Originally Posted by tancs814 View Post
    I am trying to create a command button on my form, which allows the user to open and browse for a file, and then store the specific file path into the table.
    There's an example of this in our MS Access code bank (see sticky at the top of the MS Access topic).


    Here's a direct link to the example you want: http://www.dbforums.com/microsoft-ac...ml#post6280858

    Hope this helps
    George
    Home | Blog

  3. #3
    Join Date
    Apr 2012
    Posts
    4
    Hi George,

    Thanks for your reply!

    I tried opening the zip files but failed. Is there anyway you can send me the codes?

    Thank you!

    -Cai Shan

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    I'm not sure that the error being presented is necessarily related to your OnClick code. The error "Ambiguous name detected," in Access, usually means that Access has detected two Subs bearing the same name and cannot decide which one to execute. This may be the Sub cmdBrowseDrawing_Click() or another one in your code module.

    A mistake like this commonly occurs when the developer is trying out different approaches to a problem and forgets to remove a previous attempt before trying a new one.

    If there's too much code involved to simply check by eyeballing it, use Find with the default of Current Module selected and start at the top, going thru each Sub, starting with cmdBrowseDrawing_Click(), to see if it's repeated.

    Linq ;0)>
    Last edited by Missinglinq; 04-24-12 at 23:20.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    Join Date
    Apr 2012
    Posts
    4
    Hi Missingling,

    Thanks for your reply! Indeed, I realised that one of the functions used in the code was repeated in the same module. Essentially, I have a browse for image button, and browse for drawing button in the same form. The code for the image browsing button was adapted from a code written by the same author for the "API: Call the standard Windows File Open/Save dialog box" code, hence leading to the ambiguity encountered by Access.

    Is there any other way I can browse for and store file paths? George in an earlier post has kindly recommended another thread in dbforums, but I wasn't able to open the zipfiles in that thread.

    Would you be able to help?

    Thanks!

    -caishan

  6. #6
    Join Date
    Apr 2012
    Posts
    4
    Hi George, Missingling,

    I think I have "solved it". I just have to use back the same code, but without adding an additional module, since the function has already been written in the browseimage module

    Thank you both for your help still!

    -caishan

  7. #7
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Glad you got it working!

    Good luck with your project!

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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