?
Solved

MS Access invoking File Browser via code on a 64-bit MS Access installation

Posted on 2014-09-29
4
Medium Priority
?
348 Views
Last Modified: 2014-10-27
I have code which invokes a file exploring window and allows me to select a file from the drive. However, this same module doesn't work on a MS Access 64-Bit installation.

There are many articles on how to adjust it, using PtrSafe and LongLong adjustments. I've made the adjustments and without going into too much detail at this stage, it didn't work.

Can anyone please tell me if there is any code out there, which i can use to open file explorer window, which has been written for a 64-bit version of Access?

Surely, this shouldn't be so damn difficult. Can anyone help please!!! Thank you.
0
Comment
Question by:Dylan_E
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 48

Accepted Solution

by:
Dale Fye earned 2000 total points
ID: 40351350
I used to use the API call, but now I just use a function which calls the FileDialog

Public Function GetFile(Optional Title As String = "", _
                        Optional DefaultPath As String = "C:\", _
                        Optional FileTypes As String, _
                        Optional MultiSelect As Boolean = False) As String

    Dim fd As Object
    Dim strFileTypes() As String, intLoop As Integer
    
    Set fd = FileDialog(3)  'msoFileDialogFilePicker
    With fd
    
        .Title = IIf(Title = "", "Select a file", Title)
        .InitialFileName = DefaultPath

        'Allow for multiple filetypes in the FileTypes string
        strFileTypes = Split(FileTypes, ";")
        For intLoop = LBound(strFileTypes) To UBound(strFileTypes)
            If Trim(strFileTypes(intLoop)) = "Access" Then
                .Filters.Add "Microsoft Access", "*.mdb;*.mda;*.mde;*.accdb;*.accda;*.accde"
            ElseIf Trim(strFileTypes(intLoop)) = "Excel" Then
                .Filters.Add "Microsoft Excel", "*.xl*;*.xls*"
            ElseIf Trim(strFileTypes(intLoop)) = "Text" Then
                .Filters.Add "Text", "*.txt;*.csv"
            End If
        Next
        
        'If no file type is designated, use *.*
        If UBound(strFileTypes) = -1 Then .Filters.Add "Any file type", "*.*"
        
        .AllowMultiSelect = MultiSelect
        .InitialView = 2    'msoFileDialogViewDetails
        
        'Display the popup and process the return
        If .Show = 0 Then
            GetFile = ""
        Else
            For intLoop = 1 To .SelectedItems.Count
                If GetFile = "" Then
                    GetFile = .SelectedItems(intLoop)
                Else
                    GetFile = GetFile & ";" & .SelectedItems(intLoop)
                End If
            Next
        End If
    End With
    
    Set fd = Nothing
        
End Function

Open in new window

Modify as needed
0
 

Author Closing Comment

by:Dylan_E
ID: 40351405
Thanks Dale, will try this...
0
 
LVL 58
ID: 40351904
Here's somethings that might help you in your 64bit quest.  Also, I would really re-think working in 64 bit at the moment if you can.   Not much out there in terms of controls and code samples.

Jim.

This will help you determine what might need to be changed in a current 32 bit app:

Microsoft Office Code Compatibility Inspector user's guide
http://technet.microsoft.com/en-us/library/ee833946.aspx

All the new 64 bit Window calls are here:
http://www.microsoft.com/download/en/confirmation.aspx?displaylang=en&id=9970

and a list of all the calls that were modified for 64 bit:
http://msdn.microsoft.com/en-us/library/aa383663(VS.85).aspx

You might also want to read this if you haven't already seen it (sounds like your already aware of what's here):

 Compatibility Between the 32-bit and 64-bit Versions of Office 2010
http://msdn.microsoft.com/en-us/library/ee691831(office.14).aspx

and the section "Introducing the VBA 7 Code Base" for the general overview.

Jim
0
 

Author Comment

by:Dylan_E
ID: 40407612
Thanks Jim
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question