Insert data into access database from excel userform

S

sam

Hi All,

I have a userform in excel that users would use to submit their details once
they click "Submit" button on the form. I want the details to be stored in an
Access database. But most of the users dont have access installed on their
machine.

My question is, Is it somehow possible to insert data in Access database
through Userform if access is not installed on the local machine? We have a
network drive which is shared among all and Access is installed on my
machine.

Can this be done?

Thanks in advance.
 
S

Stefan Hoffmann

hi Sam,
My question is, Is it somehow possible to insert data in Access database
through Userform if access is not installed on the local machine? We have a
network drive which is shared among all and Access is installed on my
machine.
Can this be done?
Yes, it is quite simple coding, you need a reference to the ADODB library:

Dim cn As ADODB.Connection
Dim Sql As String

Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OleDB.4.0;" & _
"Data Source=\\server\share\[path\]file.mdb"

SQL = "INSERT INTO [yourTable] (fieldList) " & _
"VALUES (valueList);"

cn.Execute SQL


If you don't like ADODB you can also use DAO.


mfG
--> stefan <--
 

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