By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,687 Members | 2,065 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,687 IT Pros & Developers. It's quick & easy.

setting CurrentProject.Connection in VBA

P: n/a
I have an ADP Project in MsAccess XP, with an MSSQL-backand (MSDE).

I would like to set the Connection of the project from VBA, so all the
forms and reports can use it. Normally, I set this through the
File->Connection menu, but if the network connection falls away for a
moment, I have to reconnect manually. I would like to reconnect
automatically with VBA.

I've tried using CurrentProject.Connection.Open and
CurrentProject.Connection.Connectionstring, but that didn't work well.

Thanks in advance,

Ol!v!
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Ol!v! wrote:
I have an ADP Project in MsAccess XP, with an MSSQL-backand (MSDE).

I would like to set the Connection of the project from VBA, so all the
forms and reports can use it. Normally, I set this through the
File->Connection menu, but if the network connection falls away for a
moment, I have to reconnect manually. I would like to reconnect
automatically with VBA.

I've tried using CurrentProject.Connection.Open and
CurrentProject.Connection.Connectionstring, but that didn't work well.

Thanks in advance,

Ol!v!


Public Sub LetConnectionString()
With CurrentProject
If Not .IsConnected Then
.OpenConnection ("PROVIDER=SQLOLEDB.1;" _
& "INTEGRATED SECURITY=SSPI;" _
& "PERSIST SECURITY INFO=FALSE;" _
& "INITIAL CATALOG=FFDBAESO;" _
& "DATA SOURCE=ITSERVER9;" _
& "Use Procedure for Prepare=1;" _
& "Auto Translate=True")
End If
End With
End Sub
--
Lyle
--
Nov 13 '05 #2

P: n/a
Lyle Fairfield wrote:

Public Sub LetConnectionString()
With CurrentProject
If Not .IsConnected Then
.OpenConnection ("PROVIDER=SQLOLEDB.1;" _
& "INTEGRATED SECURITY=SSPI;" _
& "PERSIST SECURITY INFO=FALSE;" _
& "INITIAL CATALOG=FFDBAESO;" _
& "DATA SOURCE=ITSERVER9;" _
& "Use Procedure for Prepare=1;" _
& "Auto Translate=True")
End If
End With
End Sub
--
Lyle
--

Thanks, it works great!

Ol!v!
Nov 13 '05 #3

P: n/a
Maybe this is a bad place to put this, but...

so what's are good books on ADO (and maybe ADO.NET)?

I have a copy of Database Access with VB.Net and it's just godawful.
The author doesn't do anything helpful like give a full code listing in
an index or anything like that, so it's really hard to learn unless
you're typing the whole time. fine and dandy, but hardly portable...

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.