Hi
I have an Access database that was built with Access 2003 and has been working ok with 2007. However, I have just found that there is a problem if the client machine is running Windows 7 64 bit....
The database has a form with a file browser control that the user clicks on the "browse" button and then selects a file from a windows explorer interface. The purpose of the file browser is so that the user can select a csv file from the file system which is then imported into one of the db tables.
The current solution is using a reference to "Microsoft Common Dialog Control 6.0 (SP3)" (comdlg32). The problem seems that this is not compatible with 64 bit Windows and therefore in References it is flagged as "MISSING".
Here's the code that currently works on 32 bit.....
(cmdBrowse is the form button, txtFilePath is the textbox that the full path and filename are put into and cmDialog1 is the ActiveX control - I guess the bit that doesn't work on 64 bit)
Oh, and it will need to work on XP & Win 7, 32 and 64 bit.
Many Thanks
Gary
I have an Access database that was built with Access 2003 and has been working ok with 2007. However, I have just found that there is a problem if the client machine is running Windows 7 64 bit....
The database has a form with a file browser control that the user clicks on the "browse" button and then selects a file from a windows explorer interface. The purpose of the file browser is so that the user can select a csv file from the file system which is then imported into one of the db tables.
The current solution is using a reference to "Microsoft Common Dialog Control 6.0 (SP3)" (comdlg32). The problem seems that this is not compatible with 64 bit Windows and therefore in References it is flagged as "MISSING".
Here's the code that currently works on 32 bit.....
(cmdBrowse is the form button, txtFilePath is the textbox that the full path and filename are put into and cmDialog1 is the ActiveX control - I guess the bit that doesn't work on 64 bit)
Private Sub cmdBrowse_Click()
Dim VFile As String
On Error GoTo cmdBrowse_Click_Err
ChDrive ("C")
ChDir ("C:\")
cmDialog1.Filter = "CSV Files (*.csv)|*.csv"
cmDialog1.FilterIndex = 1
cmDialog1.Action = 1
If cmDialog1.FileName <> "" Then
VFile = cmDialog1.FileName
Me!txtFilePath = VFile
End If
cmdBrowse_Click_Exit:
Exit Sub
cmdBrowse_Click_Err:
MsgBox Err.Description, , "cmdBrowse_Click"
Resume cmdBrowse_Click_Exit
End Sub
As you can see, the code is very short and simple. Can anyone recommend a way of getting this to work either by modifying what I already have or by a completely different method? Dim VFile As String
On Error GoTo cmdBrowse_Click_Err
ChDrive ("C")
ChDir ("C:\")
cmDialog1.Filter = "CSV Files (*.csv)|*.csv"
cmDialog1.FilterIndex = 1
cmDialog1.Action = 1
If cmDialog1.FileName <> "" Then
VFile = cmDialog1.FileName
Me!txtFilePath = VFile
End If
cmdBrowse_Click_Exit:
Exit Sub
cmdBrowse_Click_Err:
MsgBox Err.Description, , "cmdBrowse_Click"
Resume cmdBrowse_Click_Exit
End Sub
Oh, and it will need to work on XP & Win 7, 32 and 64 bit.
Many Thanks
Gary