Access Run-Time

N

Nick

The database that I have developed, is used by others
running Access 2000 run time. The problem is that if there
is an error on start-up the database brings up an error
message and then closes. This is because the
TransferSpreadsheet action fails because the file location
is not set on start-up. The autoexec macro and the actions
are as follows.
(1) RunCode
Public Function Init()
If Application.GetOption("Confirm Action Queries") Then
Application.SetOption ("Confirm Action Queries"),
False
End If
End Function

(2) OpenQuery
This query deletes the content of a table
(3) TransferSpreadsheet
Imports an Excel spreadsheet to the same table as action
(2). The File Name field =DLookUp
("File_Location","tbDefaults")
(4) OpenQuery
Appends to its own table
(5) OpenQuery
Appends to its own table

Can anyone tell me how to stop the actions so that the
database stays open so the file location can be set?

Regards
Nick
 
C

Craig Alexander Morrison

Nick, I do not see any mention of error handling use the On Error Goto
construct to deal with the problems this will stop the runtime crashing out.

Do not use macros. Use a startup form.
 
N

Nick

Craig,
Thank you very much for your response.
I have very limited knowledge of access and I basically
understand that I should be using some sort of code on
startup, that is why I used macros. Could you give me some
assistance on where to start with code and what do you
mean by a startup form.

Regards
Nick
 
C

Craig Alexander Morrison

You need to create a form that can start your application, more on that
later.

Once you have created this form use the menu Tools, Startup to select this
form as the form selected in the combo box labelled Display Form/Page.

Now when you run your application this form will be the first thing to open.

You need to insert some code on this form on the On Load event (well that's
the one I use generally).

If you have used a macro then use the menu Tools, Macro, Convert Macros to
Visual Basic. To retain your comments in the macros that you have and to
insert error handling ensure that both check boxes are left clicked. Once
run you will get a module called Converted Macro- NameOfYourMacro which you
can review and include this code in the On Load event or call it from the
startup form.

For further information about Visual Basic consult the help/manuals or try
the FormsCoding or Modules newsgroups and ask any remaining questions
there.

I am using Access 2003 and would suspect this is the same in 2000 and 2002.
 

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