Where do I trap error 3044?

  • Thread starter Thread starter M Skabialka
  • Start date Start date
M

M Skabialka

I have a database located on a certain drive on the server. Some of the
users have not been mapped to the correct drive letter so get this error
message when they try to open theri copy of the database front end:

<Path> is not a valid path. Make sure that the path name is spelled
correctly and that you are connected to the server on which the file
resides. (Error 3044)

At this time I do not want to use IP addresses or server names to indicate
the path.

I would like to trap this error and let them know they need that drive
mapping before they can proceed. However I don't seem to be able to find
out at what point in the code, when the database opens, that this error
message is generated. It isn't in the On Open event on the startup form,
because it doesn't even get to open the form.

Where can I trap this, tell the user to get the drive map, then shut down
the database so they aren't stuck at the database window?

Thanks,
Mich
 
If the startup form is a bound form (and if it is failing to open, it
probably is) you should be able to trap that error in the On Error event of
the form. If your startup form is an unbound form, you can add code to the
form to attempt to open a recordset on the back-end data file and trap the
error there.
 
You need to run a check before opening any bound form.

My preferred approach is to specify an unbound for as the Startup for your
database. In the Open event of this form, OpenRecordset() on some table.
That fails with the error if the Connect property of the TableDef is not
valid. You trap the error, and ask the user to handle the situation,
retrying, or quitting the database if they can't sort it out.

The last line of that Form_Open cancels the event (so this unbound form
never does open.)
 
Yes the startup form is bound to a table... this is the code that I tried
but doesn't get activated.

Private Sub Form_Open(Cancel As Integer)
On Error GoTo Err_Form_Open_Click

DoCmd.RunCommand acCmdRecordsGoToNew
Call GetUserName
'etc

Exit_Form_Open_Click:
Exit Sub

Err_Form_Open_Click:
Select Case Err.Number
Case 3044 '<Path> is not a valid path. Make sure that the path
name is spelled correctly and that
'you are connected to the server on which the file resides.
MsgBox Err.Number & " Startup form: " & Err.Description
Resume Exit_Form_Open_Click
Case Else
MsgBox Err.Description
Resume Exit_Form_Open_Click
End Select

End Sub

It seems as though the event occurs earlier than this.
Mich
 
This worked great,
Thanks,
Mich

Allen Browne said:
You need to run a check before opening any bound form.

My preferred approach is to specify an unbound for as the Startup for your
database. In the Open event of this form, OpenRecordset() on some table.
That fails with the error if the Connect property of the TableDef is not
valid. You trap the error, and ask the user to handle the situation,
retrying, or quitting the database if they can't sort it out.

The last line of that Form_Open cancels the event (so this unbound form
never does open.)
 
You need to trap this error in the On Error event, as I suggested in my
previous post ...

Private Sub Form_Error(DataErr As Integer, Response As Integer)

If DataErr = 3044 Then
MsgBox "Couldn't find path to data file"
Response = acDataErrContinue
Else
Response = acDataErrDisplay
End If

End Sub
 
Sorry, I misunderstood you. Creating another form has solved the problem.
Thanks,
Mich
 
Back
Top