Connecting to database in macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have set up a database on access and have written a form with a button.
I've tried a few things but I can't get it to look at the database. Ultimatly
it's to update sopme records. It gives an error when I try to set the
activeconnection.
 
I've wirtten this

Private Sub Command14_Click()


MsgBox ("Check")
Call ADOXUpdatetable


End Sub

Private Sub ADOXUpdatetable()

Dim cat As ADOdb.Connection
Dim tbl As ADOdb.Recordset
Dim strconn As String

strconn = "Provider = Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & CurrentProject.Connection
end sub

And nothing happends apart from the message box.
 
Markm-s,

This does not relate to macros in Access. This is a VBA procedure,
using ADO. I suggest you re-post to this newsgroup:
microsoft.public.access.modulesdaovba.ado

Having said that... why don't you directly use the table as the Record
Source of the form. If the form is "bound", you don't need code to
connect anything.
 
Back
Top