Help with code to Import Files, numerous posts..

R

Randy

I need this code revised so I can import excel files from any drive to my
"IDRa" table rather than opening it which is what it does now. This is from
Dev Ashish's example explorer97 datrabase I got off of MVP website. I am
not an access expert. I need very basic help with code below...Thanks
alot...Randy

Private Sub lbxFiles_DblClick(Cancel As Integer)
Dim varRet
Dim stPath As String

If mstPath = vbNullString Then
stPath = Left$(Me!lbxFolders, Len(Me!lbxFolders) - 1)
Else
stPath = mstPath & "\" & Me!lbxFolders
End If
varRet = fHandleFile(stPath & "\" & Me!lbxFiles, WIN_NORMAL)
End Sub
 
R

Randy

That is what I want. Iv'e pasted the code into a new module. Where do I go
from here. Thanks..I'm not a programmer, pretty basic
 
W

Wayne Morgan

The code in the blue shaded area is what goes in a module. This code
included a procedure called TestIt. Go to the Debug window (Ctrl+G) and type
TestIt and press Enter. This will give you an example of what you're trying
to do. The procedure will return the name of the file you find in a message
box. Since you're wanting to find Excel files, you'll want to change one of
the strFilter lines in the TestIt procedure to

strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.xls)", "*.XLS")

You can comment out the other strFilter lines if you don't want them.
 
R

Randy

Thanks Wayne, I got a "Compile error, ambiguaous name detected" when I tried
your suggestion below...Rany
 
W

Wayne Morgan

"Ambiguous Name Detected" would mean that you have 2 procedures with the
same name in your database. They must be unique within the database, not
just within the module. Also, a module name can't be the same as any
procedure in it or in any other module.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top