none
Kill statement not working on web browser control file RRS feed

  • Question

  • Access 2016. I have a form with a WebBrowser control named “WBControl” with =[TxtFileLoc] as its ControlSource

    I am able to locate the file (.pdf) I need and then attach it by running a query. But I can’t get the Kill statement to work:

    This is how the WebBrowser control looks before I begin running any code:

    The “Browse PDFs” button has the following code:

    Dim strSourceFolderName As String

            strSourceFolderName = Me!TxtFileLoc

            Set myfile = Application.FileDialog(msoFileDialogFilePicker)

            myfile.AllowMultiSelect = False

            If myfile.Show Then

                Me.TxtFileLoc = myfile.SelectedItems.Item(1)

            End If

    This is how my WebBrowser control looks after running BrowsePDFs and AttachPDFs until the Kill statement error message comes up.

    The Attach PDF’s button has the following code:

    Dim myfile As FileDialog

        mYN = MsgBox("Do You Want to Delete the Source File Now?", vbExclamation + vbYesNo, "USW")

        'Yes=6    No=7

        If mYN = 6 Then

            Me!TxtFileLoc = ""

            Kill (strSourceFolderName)

    OR

            Kill (Me![TxtFileLoc])

            DoEvents

            Me!WBControl.ControlSource = Me!TxtFileLoc

        End If

    Everything works well until the Kill statement. I have tried looking all over the web with no luck.

    This is the error message:

    I think I will have to return the WebBrowser control to its initial “blank” state. How can I accomplish this??? What references will I have to set to successfully do this?

    Thanks in advance.

    Friday, November 15, 2019 8:09 PM

All replies

  • Hi,

    Considering that your question is mainly related to WebBrowserControl object (Access), since this forum focuses more on questions related to Office desktop applications, if you need further assistance on this problem, I will help you move the thread to the following forum:Access for developers. You may get more helpful replies there.

    Thanks for your kind understanding.

    Best Regards,

    Herb


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Office 2019.

    Monday, November 18, 2019 1:59 AM