
Signature
Regards,
Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
Thanks Dave. This CurrentProject does indeed get me to the table I want but
I got there without a reference to a database. I want to run an update query
so I would normally say:
dbMyDB.Execute sqlMySQL$
What do I do in this case? Where's the database?
> If you're using ADO then use something like this;
>
[quoted text clipped - 17 lines]
> to
> | indicate that it is only useful for DAO connections. What's the deal?
Dave Patrick - 01 Feb 2006 01:46 GMT
Give this a go.
Set dbMyDB = CurrentProject.Connection
dbMyDB.Execute sqlMySQL$

Signature
Regards,
Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
| Thanks Dave. This CurrentProject does indeed get me to the table I want but
| I got there without a reference to a database. I want to run an update query
[quoted text clipped - 3 lines]
|
| What do I do in this case? Where's the database?
GY2 - 01 Feb 2006 16:07 GMT
Thanks for you help.
Yes, your suggestion works fine but if I've already got an open connection
is it bad form to simply use that one instead of opening two of them?
Dim rs1 As adodb.recordset
Dim cnn As adodb.Connection
'Dim dbMyDB As adodb.Connection Do I need this one as well?
Set rs1 = New adodb.recordset
Set cnn = CurrentProject.Connection
'Set dbMyDB = CurrentProject.Connection
rs1.Open "tblWhatever", cnn
'dbMyDB.Execute sqlMySQL$
cnn.Execute sqlMySQL$
> Give this a go.
>
[quoted text clipped - 10 lines]
> |
> | What do I do in this case? Where's the database?
Dave Patrick - 02 Feb 2006 03:44 GMT
No you don't need two of them. You'll only need;
Remember to always close whatever you open.
Dim cnn As adodb.Connection
Set cnn = CurrentProject.Connection
cnn.Execute sqlMySQL$
cnn.Close

Signature
Regards,
Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
| Thanks for you help.
|
[quoted text clipped - 13 lines]
| 'dbMyDB.Execute sqlMySQL$
| cnn.Execute sqlMySQL$
GY2 - 02 Feb 2006 13:01 GMT
Thanks, Dave. I think this piece is clear to me now.
> No you don't need two of them. You'll only need;
> Remember to always close whatever you open.
[quoted text clipped - 22 lines]
> | 'dbMyDB.Execute sqlMySQL$
> | cnn.Execute sqlMySQL$
Dave Patrick - 03 Feb 2006 03:24 GMT
Glad to hear it. You're welcome.

Signature
Regards,
Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft Certified Professional
Microsoft MVP [Windows]
http://www.microsoft.com/protect
| Thanks, Dave. I think this piece is clear to me now.
Albert D.Kallal - 28 Feb 2006 23:06 GMT
> dbMyDB.Execute sqlMySQL$
Well, for the built in DAO, you would go
currentdb.Execute sqMySQL
if you want to do the same thing with ADO, then use the built in ADO
object....
go
currentproject.Connection.Execute sqMSQL
here is two reocrd set loops...
'An example DAO vs ADO recordset loop, you'll see how similar they are:
'--- begin DAO ---
Dim rst As dao.Recordset
Set rst = CurrentDb.OpenRecordset("select * from contacts")
Do While rst.EOF = False
Debug.Print rst!FirstName
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
'--- end DAO ---
'--- begin ADO ---
Dim rs As New ADODB.Recordset
rs.Open ("select * from contacts"), CurrentProject.Connection
Do While rs.EOF = False
Debug.Print rs!FirstName
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
you can happily use either object.

Signature
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com
http://www.members.shaw.ca/AlbertKallal