Connecting to database in macro

M

Markm-s

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.
 
M

Markm-s

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.
 
S

Steve Schapel

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top