Solved

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

Posted on 2014-09-29
4
317 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
  • 2
4 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 500 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 57
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now