By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,652 Members | 1,441 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,652 IT Pros & Developers. It's quick & easy.

how can i move the data on datagrid to another datagrid? by using cmdsold button

P: 1
Expand|Select|Wrap|Line Numbers
  1. Dim conn As New ADODB.Connection
  2. Dim rec As New ADODB.Recordset
  3. Dim conn2 As New ADODB.Connection
  4. Dim rec2 As New ADODB.Recordset
  5.  
  6.  
  7. Private Sub cmdSearch_Click()
  8. conn.Close
  9. conn.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C:\Documents and Settings\Admin\My Documents\MynewSystem\database\PRODUCTS.MDB"
  10. rec.CursorLocation = adUseClient
  11. rec.Open "Select * From Products where ProductNo like '%" & txtSearch.Text & "%'", conn, adOpenDynamic, adLockOptimistic
  12.  
  13.     If rec.EOF Then
  14.     MsgBox "No records Found."
  15.     Else
  16.     Set ProductGrid.DataSource = rec
  17. End If
  18. End Sub
  19.  
  20.  
  21. Private Sub cmdSold_Click()
  22.  
  23. End Sub
  24. Private Sub Command1_Click()
  25. Me.Hide
  26. Load Form2
  27. Form2.Show
  28. Exit Sub
  29. End Sub
  30.  
  31.  
  32.  
  33. Private Sub Form_Load()
  34. MLeft = (Screen.Width - Me.Width) / 2
  35. Me.Top = (Screen.Height - Me.Height) / 2
  36. conn.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C:\Documents and Settings\Admin\My Documents\MynewSystem\database\PRODUCTS.MDB"
  37. rec.CursorLocation = adUseClient
  38. rec.Open "Select * From Products", conn, adOpenDynamic, adLockOptimistic
  39. Set ProductGrid.DataSource = rec
  40. conn2.Open "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C:\Documents and Settings\Admin\My Documents\MynewSystem\database\Sold.mdb"
  41. rec2.CursorLocation = adUseClient
  42. rec2.Open "Select * From Sold", conn2, adOpenDynamic, adLockOptimistic
  43. Set ProductGrid2.DataSource = rec2
  44.  
  45.  
  46.  
  47.  
  48. End Sub
  49.  
  50.  
  51.  
  52.  
  53. Private Sub Products_DragDrop(Source As Control, X As Single, Y As Single)
  54.  
  55. End Sub
Feb 14 '15 #1
Share this Question
Share on Google+
1 Reply


twinnyfo
Expert Mod 2.5K+
P: 3,484
I am not sure I understand the nature of your question. Are you merely trying to copy and paste records?
Feb 19 '15 #2

Post your reply

Sign in to post your reply or Sign up for a free account.