ahmed_optom
Registered User.
- Local time
- Today, 19:18
- Joined
- Oct 27, 2016
- Messages
- 93
My code works fine, so I can connect to my sql server and access the tables stored there.
My issue is this, if for whatever reason (no internet or firewall issue etc), the front end cant connect to the backend, then you get a horrible timeout message, and then next screen is even worse. It exposes the sql server location and user name.
I have tried "catching" the error, with the code below, however, it doesnt work, it just hangs, there is no connection or error message, it just sits there with no activity.
EDITED BY THE_DOC_MAN TO ADD CODE TAGS. (NO OTHER EDITS PERFORMED)
If there a way to catch this error? or to connect to the backend differently to avoid this?
My issue is this, if for whatever reason (no internet or firewall issue etc), the front end cant connect to the backend, then you get a horrible timeout message, and then next screen is even worse. It exposes the sql server location and user name.
I have tried "catching" the error, with the code below, however, it doesnt work, it just hangs, there is no connection or error message, it just sits there with no activity.
EDITED BY THE_DOC_MAN TO ADD CODE TAGS. (NO OTHER EDITS PERFORMED)
Code:
If DCount("Name", "MSysObjects", "Name = 'tablenamexxxxxxx' and Type = 4") <> 0 Then 'The table exist
DoCmd.DeleteObject acTable, "tablenamexxxxxxx"
End If
Set dbs = CurrentDb
Set tdf = dbs.CreateTableDef("tablenamexxxxxxx")
tdf.SourceTableName = "tablenamexxxxxxx"
'error handle for connection
On Error GoTo ErrHandler
tdf.Connect = sConnect
Exit Sub
ErrHandler:
MsgBox "Connection Error"
dbs.TableDefs.Append tdf
dbs.TableDefs.Refresh
If there a way to catch this error? or to connect to the backend differently to avoid this?
Attachments
Last edited by a moderator: