CARA MEMBUAT CONNECTION STRING DENGAN MS ACCESS KE SQL SERVER
buat 1 form. misal Form1
4 textbox.
txtNamaServer
txtNamaDatabase
txtNamaUser
txtPassword
2 CommandButton
cmdKonek
cmdGakJadi
Private Sub cmdKonek_Click
Konek txtNamaServer. value, txtNamaDatabase. value, txtnamauser. value,
txtPassword. value
end sub
Private Sub cmdGakJadi
docmd.close 'check lagi sintaksnya
end sub
Function Konek(pServer, pDB, pUser, pPwd) As Boolean
Konek = True
On Error GoTo Konek_Err
bc = "PROVIDER=SQLOLEDB;" & _
"PERSIST SECURITY INFO=TRUE;" & _
"DATA SOURCE=" & pServer & ";" & _
"USER ID=" & pUser & ";" & _
"PASSWORD=" & Nz(pPwd, "") & ";" & _
"INITIAL CATALOG=" & pDB
' first close current connection
CurrentProject. CloseConnection
' then establish new connection
CurrentProject. OpenConnection (bc)
Konek_Exit:
Exit Function
Konek_Err:
MsgBox Err.Description, vbCritical, "Caution"
Konek = False
Resume Konek_Exit
End Function
semoga membantu
salam..
Yahoo! Mail Kini Lebih Cepat dan Lebih Bersih. Rasakan bedanya sekarang!
http://id.mail.yahoo.com