Importing Files

A

Antony Elson

Many thanks for all of your help, I have now got the code
to import a selected file, but if I cancel the selection
it now returns an error message.

I presume this is down to the fact that the
strInputFileName is empty.

Is there a way that I can fix this?

Also I would like the last field that gets imported to
display the login name. Do you know if there is any way of
getting access to do this??
 
C

Cheryl Fischer

Antony,

I usually have a procedure behind a command button which contains the code
to allow the user to select the file followed by the code to do the import.
Between these two processes, I have a bit of code which tests to be sure the
user did not cancel the file selection:

If strInputFile = "" Then
' User cancelled
MsgBox "Cancellation of operation accepted."
Exit Sub
End If

If the user did in fact cancel the operation, the "Exit Sub" line ends the
procedure so the code to do the import is not processed.

As to your second question, when you do the import are you appending records
into an existing table with a field for the UserID? If so, there is code
(again, at the Access Web) to determine the network userid with a function
call:

API: Get login name
http://www.mvps.org/access/api/api0008.htm
 

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

Similar Threads


Top