In VBA check for ODBC or Network Connection

  • Thread starter Thread starter Lee T.
  • Start date Start date
L

Lee T.

I have a user that wishes to use a database on a laptop in
the field. They need an update button to import data from
the ISeries (AS/400). I would like the update to not run
(as in hide or disable the button for importing data) if
1. The ODBC connection is not on the machine
******** OR ********
2. The PC is not on the network (look for a file on a
network drive or if the drive exists)

How can I do this in VBA code?

TIA

Lee T.
 
Maybe in the startup code for the database, you could do something that
would fail with an error if the onnection was not present of the PC was not
on the network? Pehaps query a remote table for the TOP 1 records? Use error
trapping (on error resume next) to suppress the normal message. Enable or
disable the import button, depending on whether that quick check did or did
not get an error. Or, set a global variable with the result (true=ok,
false=not ok) so the form can enable/disable the button later, when
appropriate.

HTH,
TC
 
-----Original Message-----
I have a user that wishes to use a database on a laptop in
the field. They need an update button to import data from
the ISeries (AS/400). I would like the update to not run
(as in hide or disable the button for importing data) if
1. The ODBC connection is not on the machine
******** OR ********
2. The PC is not on the network (look for a file on a
network drive or if the drive exists)

How can I do this in VBA code?

TIA

Lee T.
.
 
Back
Top