Page 1 of 2 12 LastLast
Results 1 to 15 of 27
  1. #1
    mwolfod is offline Advanced Beginner
    Windows 7 Access 2003
    Join Date
    Oct 2010
    Posts
    36

    Code does not work in 64 Bit Access 2010

    The code below in Access 2003 opens up a file broswer so that the path to images on a server can be inserted into a TextBox on a Form.



    In trying to convert to Access 2010 64 BIT, I receive the error message to insert the ptrSafe command in the Declare statements to allow them to work under 64 Bit Access.

    However, once I do that, clicking on the Command Button which triggers the code, results in no action.

    Is there alternative code, for this simple function that will work in 64 Bit Access?

    Code:
    Dim strStartDir As String        Dim strFilter As String    Dim lngFlags As Long        ' Start the file browser from the desired directory         strStartDir = "F:\My Documents\DigitalImages"    strStartDir = Left(strStartDir, Len(strStartDir) - Len(Dir(strStartDir)))    strFilter = ahtAddFilterItem(strFilter, _                        "Word Documents (*.doc)", "*.doc")    strFilter = ahtAddFilterItem(strFilter, _                        "Excel Files (*.xls)", "*.xls")    strFilter = ahtAddFilterItem(strFilter, _                        "All files (*.*)", "*.*")    Me.ODPosteriorSegmentImagePath1TextBox = ahtCommonFileOpenSave(InitialDir:=strStartDir, _                     Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _                     DialogTitle:="Select File")                         strPhotoPath = Nz(Me![ODPosteriorSegmentImagePath1TextBox], "")    Me!ODPosteriorSegmentImageFrame1.ImageViewFile strPhotoPath

  2. #2
    mwolfod is offline Advanced Beginner
    Windows 7 Access 2003
    Join Date
    Oct 2010
    Posts
    36
    The attached is a better view of the code.

    Thanks.

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I don't know if we have anyone else in the forum that is using the 64bit version of Access.

  4. #4
    mwolfod is offline Advanced Beginner
    Windows 7 Access 2003
    Join Date
    Oct 2010
    Posts
    36
    Quote Originally Posted by RuralGuy View Post
    I don't know if we have anyone else in the forum that is using the 64bit version of Access.
    Yes, I am kind of coming to that realization, and not just here, on this Forum.

    As a non IT pro, I just though it made perfect sense, to go with 64 bit Office as part of my overall move to Windows 7 64 Bit.

    I guess widespread adoption of 64 bit Office (or at least Access) is a few years away?

    I welcome any general comments on this subject, FROM ANYONE as I am at a critical decision point here on which way to go.

    Thanks.

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I reformatted your code and the RED code does not look viable. Am I wrong?
    Code:
       Dim strStartDir As String
       Dim strFilter As String
       Dim lngFlags As Long
       ' Start the file browser from the desired directory
       strStartDir = "F:\My Documents\DigitalImages"
       strStartDir = Left(strStartDir, Len(strStartDir) - Len(Dir(strStartDir)))
       strFilter = ahtAddFilterItem(strFilter, "Word Documents (*.doc)", "*.doc")
       strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.xls)", "*.xls")
       strFilter = ahtAddFilterItem(strFilter, "All files (*.*)", "*.*")
       Me.ODPosteriorSegmentImagePath1TextBox = ahtCommonFileOpenSave(InitialDir:=strStartDir, _
                                                                      Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
                                                                      DialogTitle:="Select File")
       strPhotoPath = Nz(Me![ODPosteriorSegmentImagePath1TextBox], "")
       Me!ODPosteriorSegmentImageFrame1.ImageViewFile = strPhotoPath

  6. #6
    mwolfod is offline Advanced Beginner
    Windows 7 Access 2003
    Join Date
    Oct 2010
    Posts
    36
    Actually, Access VB seemed to be objecting to the first occurrence of the aht statement. That led to the discovery that I needed to put the ptrSafe statement in the Declare statements of the accompanying Module, which then resulted in no response when the code was run, after compiling.

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you used the debugger to single step the code? I still think that last line should have a "=" in it somewhere.

  8. #8
    mwolfod is offline Advanced Beginner
    Windows 7 Access 2003
    Join Date
    Oct 2010
    Posts
    36
    Yes I used the step process during the debug.

    Yes, there is an equal sign just before the last word "strPhotoPath". It must have dropped out during the copy to the Forum.

  9. #9
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    So single stepping, the Me.ODPosteriorSegmentImagePath1TextBox never gets filled with anything, right?

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    This may be a real dumb question but have you set your trusted location yet and is this file in it?

  11. #11
    mwolfod is offline Advanced Beginner
    Windows 7 Access 2003
    Join Date
    Oct 2010
    Posts
    36
    Quote Originally Posted by RuralGuy View Post
    So single stepping, the Me.ODPosteriorSegmentImagePath1TextBox never gets filled with anything, right?
    Right.

    When I click on the command button that launches the code, nothing happens. No error message, but no opening of the file browser on the server either.

  12. #12
    mwolfod is offline Advanced Beginner
    Windows 7 Access 2003
    Join Date
    Oct 2010
    Posts
    36
    Quote Originally Posted by RuralGuy View Post
    This may be a real dumb question but have you set your trusted location yet and is this file in it?

    Sorry, I don't know what you mean by this.

  13. #13
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Since ac2007, Access has had a Trusted Location and code and macro's do not run unless your db in in the Trusted Location. http://www.btabdevelopment.com/ts/de...aspx?PageId=13

  14. #14
    mwolfod is offline Advanced Beginner
    Windows 7 Access 2003
    Join Date
    Oct 2010
    Posts
    36
    Quote Originally Posted by RuralGuy View Post
    Since ac2007, Access has had a Trusted Location and code and macro's do not run unless your db in in the Trusted Location. http://www.btabdevelopment.com/ts/de...aspx?PageId=13

    Interesting. I did not know that, still being a 2003 user.

    The Trusted Center had the Access Program folder listed (C:/Program Files/etc..... (since it is 64 bit)), so I added the location where my actually accdb file is located, which for now, is simply the desktop.

    Unfortunately, that did not change anything: Still no response when the command button is clicked.

  15. #15
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    When you single step, does the code get to the API call?

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Word.Basic ToolsSpelling won't work in Access 2010
    By stav.kaufman in forum Programming
    Replies: 6
    Last Post: 11-23-2010, 08:44 AM
  2. Word code in Access - How to modify my current code
    By Alexandre Cote in forum Programming
    Replies: 0
    Last Post: 11-15-2010, 08:26 AM
  3. 2007 Access DB won't work in 2010 - 64 bit
    By InvGrp in forum Access
    Replies: 2
    Last Post: 07-12-2010, 08:45 AM
  4. Query doesn't work when launched by code
    By stephenaa5 in forum Queries
    Replies: 1
    Last Post: 10-24-2009, 09:52 AM
  5. VBA Code To Work With MySQL
    By botts121 in forum Programming
    Replies: 0
    Last Post: 07-08-2009, 08:51 AM

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