G
Guest
Hello,
I built a form with a command button that open the FileDialog to retrieve
the path of a database to which I have to connect. Here is the code of the
button:
'Declare a variable as a FileDialog object.
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
Dim quale_path As String
If fd.Show = -1 Then
quale_path = fd.SelectedItems(1)
path_db.Value = quale_path
pathdef = path_db.Value
path_db.Enabled = False
End If
I need to check if the user have selected a .mdb or a .mde file. I have
tried somethjing like
If right(fd.SelectedItems(1),3)<> "mdb" or right(fd.SelectedItems(1),3)<>
"mde" then
msg to user that a wrong file has been selected
else
....
end if
It seems it doesnt' work! I always receive the msg to user that a wrong file
has been selected. There's a better way?
Thanks
Rocco
I built a form with a command button that open the FileDialog to retrieve
the path of a database to which I have to connect. Here is the code of the
button:
'Declare a variable as a FileDialog object.
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
Dim quale_path As String
If fd.Show = -1 Then
quale_path = fd.SelectedItems(1)
path_db.Value = quale_path
pathdef = path_db.Value
path_db.Enabled = False
End If
I need to check if the user have selected a .mdb or a .mde file. I have
tried somethjing like
If right(fd.SelectedItems(1),3)<> "mdb" or right(fd.SelectedItems(1),3)<>
"mde" then
msg to user that a wrong file has been selected
else
....
end if
It seems it doesnt' work! I always receive the msg to user that a wrong file
has been selected. There's a better way?
Thanks
Rocco