Access 03- SQL 2005 Direct Connection

silenthillpsp

New member
Local time
Today, 03:04
Joined
Jul 2, 2008
Messages
2
:D Hello Everyone,

I have a database created in Access 2003 and same database in SQL server 2005. What I want to do is;
update, delete, add data into SQL database using Access form.(with Command buttons) How can I connect
and modify sql database from Access form and what codes I have to use? Please help me!!
 
Last edited:
I found the solution. Thanks anyway.. Here is the code that saved my life :)

Dim Cnxn As ADODB.Connection
Dim rstsqlTablename As ADODB.Recordset
Dim strCnxn As String
Dim strSQL As String

' Open a connection
Set Cnxn = New ADODB.Connection
strCnxn = "Provider=sqloledb;DRIVER=SQL Server;SERVER=servername;DATABASE=databasename;UID=username;PWD=password;"
Cnxn.Open strCnxn

' Open Employees Table with a cursor that allows updates
Set rstRECORD = New ADODB.Recordset
strSQL = "sqlTablename"
rstKAYIT.Open strSQL, strCnxn, adOpenKeyset, adLockOptimistic, adCmdTable
 

Users who are viewing this thread

Back
Top Bottom