stevennathaniel

VBA MS Access : ACE.OLEDB.12 Insert Data ke Tabel

Mar 15th, 2016
143
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Private Sub Command10_Click()
  2.  
  3. 'Connection string for ADO.NET via OleDB
  4.  
  5. Dim connector As ADODB.Connection
  6.  
  7. Set connector = Nothing
  8.  
  9. Dim strStatement As String
  10.  
  11. strStatement = "INSERT INTO dataUsia(idusia,namaawal,namaakhir,usia)values" & "('IU00001','Steven','Nathaniel','17')"
  12.  
  13. Set connector = New ADODB.Connection
  14.  
  15. 'Set connector = Nothing
  16.  
  17. connector.Open "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=D:\fileAccess\Database3.mdb; Persist Security Info=False"
  18.  
  19. connector.Execute strStatement
  20.  
  21.  
  22. connector.Close
  23.  
  24. Set connector = Nothing
  25.  
  26.  
  27.  
  28.  
  29. End Sub
RAW Paste Data