daily pastebin goal
28%
SHARE
TWEET

ff

a guest Feb 18th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Compare Database
  2.  
  3. Dim cnn As New ADODB.Connection
  4. Dim cmd As New ADODB.Command
  5. Dim rst As New ADODB.Recordset
  6.  
  7.  
  8. Private Sub cmbPodrazd_AfterUpdate()
  9. Dim i As Integer
  10. Dim a As Integer
  11.     cnn.CursorLocation = adUseClient
  12.     cnn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=I:\VBA\tblZaiavka_2.accdb"
  13.     cnn.Mode = adModeRead
  14.     cnn.Open
  15.     cmd.ActiveConnection = cnn
  16.     cmd.CommandText = "select * from tblPodrazd"
  17.     Set rst = cmd.Execute
  18.     a = rst.RecordCount
  19.     For i = 1 To a Step 1
  20.     cmbPodrazd.AddItem rst.Fields("Ïîäðàçäåëåíèå")
  21.     rst.MoveNext
  22.     Next i
  23.     Set cnn = Nothing
  24. End Sub
  25.  
  26. Private Sub cmdStart_Click()
  27.     cnn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=E:\VBA\tblZaiavka_2.accdb"
  28.     cnn.Mode = adModeRead
  29.     cnn.Open
  30.     CurrentDb.Execute "INSERT INTO tblZaiawka(Äàòà, ÒàáÍîìåð, Îòäåë, Ïîäðàçäåëåíèå, Ðåñóðñ) VALUES" & _
  31.     "('" & txtData.Value & "', '" & cmbSotrydnic.Value & "', '" & cmbOtdel.Value & "', '" & CmbPodrazdel.Value & "', '" & txtResyrs.Value & "')"
  32.     cnn.Close
  33.     Set cnn = Nothing
  34. End Sub
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top