Add Filename to Imported Files from Excel VB

I have a VB code that imports data from multiple excel worksheets into a single Access 2010 table.

This code works just FINE for me.

But, I do need to add one thing. Along with the imported data it's capturing, I need the 'FileName' loaded into an additional column.  Can someone tweak the code to account for this update?

The code is attached.  Let me know if you have any questions for me to proceed,

Function Impo_allExcel()
Dim myfile
Dim mypath

mypath = "C:\My Documents\Test\"
ChDir (mypath)
myfile = Dir(mypath)
Do While myfile <> ""
  If myfile Like "*.xlsm" Then
     'this will import ALL the excel files
     '(one at a time, but automatically) in this folder.
     ' Make sure that's what you want.
    DoCmd.TransferSpreadsheet acImport, 8, "Contacts_AVDC_NEW", mypath & myfile, True, "A7:H100"
  End If
  myfile = Dir()
End Function
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rey Obrero (Capricorn1)Commented:
after this line

DoCmd.TransferSpreadsheet acImport, 8, "Contacts_AVDC_NEW", mypath & myfile, True, "A7:H100"

'Add this line
currentdb.execute "update [Contacts_AVDC_NEW] set [FileNameField]='" & myfile & "' where [FileNameField] is null"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ctownsen80Author Commented:
Perfect! Thanks Rey!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.