I am not sure of your question but if you meant you want to create a
Connection Object in code which is the same as your ***ADP*** Connection
then simply use:
Dim cnn As ADODB.Connection
Set cnn = CurrentProject.Connection
If you are using ***MDB***, the CurrentProject.Connection points to your
MDB, not SQL Server so it is of no help in this case.
Re-post with more details if I guessed incorrectly.
--
HTH
Van T. Dinh
MVP (Access)
> Thankes Van
>
> How can i do this for the currentProject.Connection?
Roy Goldhammer - 18 Sep 2003 06:14 GMT
Well Van.
The problem is this?
sometimes on my computer the connection to sql server is being stoped and i
need to reconnect it again.
The way i solve this so far is by entering to file -> Connect and reconnect
to sql server. After that i create a function that tests the connection to
sql server on any form i open and if the ADP is not connected it runs the
file -> connect menu automaticly. The problem is that i can work with this
but the client will never do such a thing like that
so my question is: can i do that the file -> connect menu order do with my
code: connectiog to sql server?
> I am not sure of your question but if you meant you want to create a
> Connection Object in code which is the same as your ***ADP*** Connection
[quoted text clipped - 16 lines]
> >
> > How can i do this for the currentProject.Connection?
Van T. Dinh - 18 Sep 2003 23:27 GMT
Can test at the moment but there is a command:
DoCmd.RunCommand acCmdConnection
you may like to try (I never used it, though).
--
HTH
Van T. Dinh
MVP (Access)
> Well Van.
>
[quoted text clipped - 32 lines]
> > >
> > > How can i do this for the currentProject.Connection?