Rabu, 27 Juli 2011

[belajar-access] KONEKSI LAN

 



--- On Sun, 10/7/11, hari yanto <har_i20002000@yahoo.com> wrote:

From: hari yanto <har_i20002000@yahoo.com>
Subject: Re: [belajar-access] Re: Aplikasi via LAN
To: belajar-access@yahoogroups.com
Date: Sunday, 10 July, 2011, 7:31 AM

 
Kalau saya, saya memanfaatkan ODBC via VBA (agar tidak mensetting lewat control panel > administrative tools). Saya taruh di Module. Terus, saya panggil via form. Berikut adalah scriptnya:
 
 
Public Function KonAC(Optional ByVal serverName As String = "", _
   Optional ByVal userName As String = "", Optional ByVal userPass As String = "", _
   Optional ByVal dbPath As String = "", Optional ByVal dbName As String = "") As Boolean
   Dim strCon As String
   On Error GoTo errHandle
        If Len(userPass) > 0 Then
           strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & dbPath & "\" & dbName & ";" & _
           "Jet OLEDB:Database Password=" & userPass & ""
        Else
           strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & dbPath & "\" & dbName & ""
        End If
   Set Kon = New ADODB.Connection
   Kon.ConnectionString = strCon
   Kon.Open
   KonAC = True
   Exit Function
errHandle:
   KonAC = False
End Function
'misal dbPath = D:\DATA
'sedang databasenya = master.mdb
 
Untuk mengujinya, pakai ini:
 
Private Sub Command0_Click()
        ToACC
        If Kon.State <> 0 Then
                MsgBox "Koneksi sukses"
                'isi sql selanjutnya
        end if
        Kon.Close
        Set Kon = Nothing
End Sub
 
Semoga bisa membantu dan memberi semangat..
 
Hariyanto (Surabaya)

--- On Sun, 10/7/11, Krisna Wibawanto <krisna_wibawanto@yahoo.co.id> wrote:

From: Krisna Wibawanto <krisna_wibawanto@yahoo.co.id>
Subject: [belajar-access] Re: Aplikasi via LAN
To: belajar-access@yahoogroups.com
Date: Sunday, 10 July, 2011, 12:34 AM

 
Cara yg paling gampang kayaknya di-share aja database-nya deh Bozz..

__._,_.___
Recent Activity:
SPAM IS PROHIBITED
.

__,_._,___

Tidak ada komentar:

Posting Komentar