Solved

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

Posted on 2014-09-29
4
323 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
is there a opposite on ON CURRENT in ms/access 15 34
data analyst 3 50
Storing Combo Box Selection in Table 12 45
Find missing numbers in Access Table PrimaryKey 9 17
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
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.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

863 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