Read external files (1 Viewer)

gstylianou

Registered User.
Local time
Today, 11:20
Joined
Dec 16, 2013
Messages
357
Dear friends,

I have the following simple code which working fine in order to read any external files into an access form. But, the problem is the confirmation message after the selection of the file (attached). Is there a way to skip the confirmation after the selection of the file?

The code:

Option Compare Database
Option Explicit

Private Sub btnBrowse_Click()
Dim file As FileDialog
Set file = Application.FileDialog(msoFileDialogFilePicker)

file.AllowMultiSelect = False

If file.Show Then
Me.txtFileLocation = file.SelectedItems.item(1)
End If

End Sub
 

Attachments

  • OpenMesg.JPG
    OpenMesg.JPG
    45.6 KB · Views: 136

Minty

AWF VIP
Local time
Today, 09:20
Joined
Jul 26, 2013
Messages
10,355
I got around this by listing all the files in a list box, and performing the action on the selected file.

I'm sure that without Windows API calls you can't get around it, as it's part of the windows process.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:20
Joined
Oct 29, 2018
Messages
21,358
Dear friends,

I have the following simple code which working fine in order to read any external files into an access form. But, the problem is the confirmation message after the selection of the file (attached). Is there a way to skip the confirmation after the selection of the file?

The code:

Option Compare Database
Option Explicit

Private Sub btnBrowse_Click()
Dim file As FileDialog
Set file = Application.FileDialog(msoFileDialogFilePicker)

file.AllowMultiSelect = False

If file.Show Then
Me.txtFileLocation = file.SelectedItems.item(1)
End If

End Sub
Hi. I use that piece of code all the time and I never get the warning you're showing us. I have only seen this warning when I click on a link on a web browser. So, I am thinking you're either clicking on a browser or on some sort of link when you get this warning. But I don't think it's coming from the code you posted.
 

Micron

AWF VIP
Local time
Today, 05:20
Joined
Oct 20, 2018
Messages
3,476
The documents likely come from an external source such as web or cloud drive. You will get this every time you open that file if for example, you downloaded it from a Google drive. I was recently wondering how to set a flag that a file is OK but didn't see the option and haven't had time to pursue it.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:20
Joined
Oct 29, 2018
Messages
21,358
The documents likely come from an external source such as web or cloud drive. You will get this every time you open that file if for example, you downloaded it from a Google drive. I was recently wondering how to set a flag that a file is OK but didn't see the option and haven't had time to pursue it.
This is what I was thinking as well, but the image the OP posted shows the file is coming from a folder in the C:\ drive. Also, using the FileDialog code posted above, is it possible to navigate to a cloud drive using it? Thanks.
 

Micron

AWF VIP
Local time
Today, 05:20
Joined
Oct 20, 2018
Messages
3,476
for example, you downloaded it from a Google drive
In my experience it matters not where you're opening it from; it matters where it came from. If that is an external source I get the warning. I'm saying possibly even my own files downloaded from Google drive but I can't recall for sure. I can say no problem if from One Drive and you are the author because that's just another folder in your system.
EDIT - Sorry, missed addressing your question. I doubt it if it's akin to Google drive, but I don't see why you couldn't navigate to One Drive. Never tried.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 02:20
Joined
Oct 29, 2018
Messages
21,358
In my experience it matters not where you're opening it from; it matters where it came from. If that is an external source I get the warning. I'm saying possibly even my own files downloaded from Google drive but I can't recall for sure. I can say no problem if from One Drive and you are the author because that's just another folder in your system.
Makes sense. Thanks!
 

gstylianou

Registered User.
Local time
Today, 11:20
Joined
Dec 16, 2013
Messages
357
Hi,

Really don't know what happened but attached you can see the problem persist in my real database
 

Attachments

  • ReadEdit Word.accdb
    608 KB · Views: 119

theDBguy

I’m here to help
Staff member
Local time
Today, 02:20
Joined
Oct 29, 2018
Messages
21,358
Hi,

Really don't know what happened but attached you can see the problem persist in my real database
Hi. So, just as I suspected, a web browser is involved in this issue. I don't think you'll be able to use this approach other than for Text or PDF files (or any other files that play nice with web browsers, like images). You will have to find a better ActiveX control that can handle multiple types of files to use this approach. Otherwise, you will have to use a different approach to open the Word document inside the Word application, instead of the web browser on your form.
 

Users who are viewing this thread

Top Bottom