Open Dialog filter problem?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • strat18
    New Member
    • May 2009
    • 6

    Open Dialog filter problem?

    My database code works on my server and one laptop, but does not function correctly on two other laptops, all four systems run Vista Business and MSaccess 2007. The code is set up to display the file path in the open dialog file name box, that way the user clicks a button on a form, the open dialog box pops up, and the user just hits enter to open the file (the only reason the dialog box pops up is if the user wants to open a different file) since the file path is already selected. This works on 2 different computers, a server and a stand alone. My problem is that on two other stand alone computers, only the folder path is opened, and the user has to search through many files manually. I am assuming it is some type of a filter setting somewhere...but what would cause this? Even on the two computers that do not work, the filename path is correct, it isn't making it to the file name box in the open dialog screen.

    Brian
  • ChipR
    Recognized Expert Top Contributor
    • Jul 2008
    • 1289

    #2
    Just for a start, what is the code you're using?

    Comment

    • strat18
      New Member
      • May 2009
      • 6

      #3
      ChipR,

      Here is a sample of what I'm using...pretty much if there is a file associated with the record, open that file path...it works great on 2 of my computers but the other 2, only the folder path is opened...and I have to search manually through a lot of files...

      Code:
      If checklist_file > "" Then
              openfilepath = openfilepath & checklist_file
          Else
              If asTemplate = True Then
                  openfilepath = openfilepath & DLookup("cfgValue", "_config", "cfgname='mastertemplate'")
              Else
                  openfilepath = openfilepath & "*.xml"
              End If
          End If
          Set fd = Application.FileDialog(1)
          fd.initialfilename = openfilepath
          fd.allowmultiselect = False
          fd.show
          If fd.selecteditems.Count <> 1 Then
              checklist_file = ""
          Else
              checklist_file = fd.selecteditems(1)
          End If
      Brian
      Last edited by Denburt; May 1 '09, 05:19 PM. Reason: Code Tags

      Comment

      • ChipR
        Recognized Expert Top Contributor
        • Jul 2008
        • 1289

        #4
        I'm not sure what version of Access you're using, but the 2003 reference says that msoFileDialogOp en is not supported. Maybe try:
        Code:
        Set fd = Application.FileDialog(3) 'msoFileDialogFilePicker.

        Comment

        • DonRayner
          Recognized Expert Contributor
          • Sep 2008
          • 489

          #5
          On Vista if you install your front-end db into "Program Files" you may be having problems with Data Redirection sending you to an old version of the Database.

          If that's the case, this link should be able to offer you some insights.

          Comment

          • strat18
            New Member
            • May 2009
            • 6

            #6
            Chip,

            I tried your suggestion with negative the same results on my laptop. I also tried the database on another computer with 2003 and the original code worked there as well.

            Don,

            I do have the database and all associated files under the user documents folder. I will look into permissions to see if that may have anything to do with it but I can write new data to the tables...All of my config paths load correctly, it is strange that just this dialog box doesn't want to play nice. I was wondering if the newer laptops might have a different dll library or something that isn't executing the code as it should...

            Comment

            • ChipR
              Recognized Expert Top Contributor
              • Jul 2008
              • 1289

              #7
              Can we assume that all the systems are accessing the same recordset, then opening to the same directory on a server? Have you double checked the contents of openfilepath just before trying to show the dialog on the machines where it isn't working correctly?

              Comment

              • Denburt
                Recognized Expert Top Contributor
                • Mar 2007
                • 1356

                #8
                You might want to check it could possibly be the wild card character especially since you are using 2007 it could be an ANSI standard issue.




                openfilepath = openfilepath & "*.xml"

                Comment

                • strat18
                  New Member
                  • May 2009
                  • 6

                  #9
                  chip,

                  I have used the watchlist to see that the entire file path was loaded into openfilepath... then when I step to open the dialog box, all I get is the folder path...I even checked a few lines of code later and still have the correct file path in openfilepath... it's almost like it is being filtered to the folder level...

                  Denburt,

                  Do you still think that it would be that line of code since I have the file name in the checklist_file variable and it skips those few lines under the else statement...

                  openfilepath = "C:\Users\Certi fications\Docum ents\Certificat ions\checklist\ 1319_Inmarsat Mini-M.xml"

                  which is the correct path...the dialog box is just cutting off the file name at the end...

                  Comment

                  • ChipR
                    Recognized Expert Top Contributor
                    • Jul 2008
                    • 1289

                    #10
                    I'm stumped. In my test, even a file that didn't actually exist would still automatically be put into the File Name box of the open dialog.

                    Comment

                    • strat18
                      New Member
                      • May 2009
                      • 6

                      #11
                      I know...I'm there too...especiall y since I know that the code works...I'm thinking that it is something about the laptops...filte r or setting or library that isn't liking the msofiledialogfo lderpicker...if I put a 2 instead of a 1 or 3, it tries to save the file and puts the right file name under the file name edit control...which is what I want but in reverse, I want it to do that and open a file...but neither 1 or 3 seem to do anything...

                      I'm looking into the msofiledialogfo lderpicker right now...where does it get its parameters from...is this a library?

                      Comment

                      • Denburt
                        Recognized Expert Top Contributor
                        • Mar 2007
                        • 1356

                        #12
                        Well I am going to agree that it must be a version of a dll or something in the way of corruption however if it doesn't seem to be a wild card issue and it is happening on a defined path then you may consider several things. The file you are using "C:\Users\Certi fications\Docum ents\Certificat ions\ checklist\1319_ Inmarsat Mini-M.xml" Has a space an underscore and dash, perhaps if you remove those then test it. I know it shouldn't be an issue but you just may be surprised... I have had tables with two underscores in the name that would do the strangest things, again it shouldn't have been an issue but it was, I had to completely restructure a whole DB one time.

                        Comment

                        • NeoPa
                          Recognized Expert Moderator MVP
                          • Oct 2006
                          • 32633

                          #13
                          Brian,
                          As a final check, can you trace through the code on two separate PCs (one which does, and one which doesn't work) and post :
                          1. The line of code.
                          2. The value of each variable referenced in the line of code.

                          Please ensure everything possible is done to make both versions are as similar as possible.

                          PS. In case you need assistance with tracing see Debugging in VBA.

                          Comment

                          • strat18
                            New Member
                            • May 2009
                            • 6

                            #14
                            I'm out of the office for the next two weeks, I'll try running the script and compare between a good cpu and one it doesn't run on when I get back in...

                            Comment

                            • NeoPa
                              Recognized Expert Moderator MVP
                              • Oct 2006
                              • 32633

                              #15
                              That's fine.

                              We'll catch up when you get back :)

                              Comment

                              Working...