macro fails but why

J

Jesper F

I have a database deployed in several locations and the users are getting a
failed autoexec macro:
http://img341.imageshack.us/img341/7089/macrofailez2.jpg (in Danish,
shouldn't matter)

I need help figuring out what's going wrong. The database and function seem
to working fine on my computer.
The autoexec macro is only running the function below (The function
"fRefreshLinkedTables" relinks tables and i has error handling)

What I don't understand is why the users aren't getting the messagebox that
the error handling produces and instead see the Macro-Failed alert box? What
kind of error exit the macro and produce the macro-failed box?
Thanks.

/ Jesper

---------------
Function fStartup()
On Error GoTo err_

Dim db As DAO.Database
Dim tdf As TableDef
Dim i As Integer
Dim sDirFile As String
Dim sMsg As String
Dim sSted As String

Set db = CurrentDb

sMsg = "An error occured."

Application.SetOption "Error trapping", 2
Application.SetOption "ShowWindowsInTaskbar", 0 'false
Application.SetOption "Move After Enter", 1

DoCmd.OpenForm "frmhidden", , , , , acHidden

sDirFile = Forms!frmhidden!txtBackend

fRefreshLinkedTables sDirFile

db.Execute "INSERT INTO tblLog (username) VALUES ('" & CurrentUser & "')",
dbFailOnError

Set db = Nothing

Exit Function
exit_:
Exit Function
err_:
Select Case Err.Number
Case 9999
Resume exit_
Case Else
MsgBox "Error occured while linking tables " & Err.Description,
vbOKOnly + vbCritical
Resume exit_
End Select
End Function
 
A

Allen Browne

Perhaps macro security is preventing the code from running?

For example, in Access 2003, go to:
Tools | Macros | Security
and set to Low.
Also "allow unsafe expressions" for JET.
 

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