Hi all,
I have two tables in my database. Each table has a form where i use the Insert into command to add data. i also have a "Master edit page" where values from both tables are on the form and can be edited. The problem im having is updating both tables with a single click(cmdSave).
The second table does not get updated. Any help would be greatly appreciated. (vb6 with access 2007)Code:Private Sub cmdSave_Click() Set r = New ADODB.Recordset With r .ActiveConnection = c .CursorType = adOpenDynamic .LockType = adLockOptimistic .Source = "SELECT* FROM Main WHERE orderno=" & "'" & cmbOrderno.Text & "'" .Open .Fields("quantity") = (Me.txtQuantity.Text) .Fields("quantity2") = (Me.txtQuantity2.Text) .Fields("unitprice") = Val(Me.txtUnitprice.Text) .Update .Close End With Set r = New ADODB.Recordset With r .ActiveConnection = c .CursorType = adOpenDynamic .LockType = adLockOptimistic .Source = "SELECT* FROM orders WHERE orderno=" & "'" & cmbOrderno.Text & "'" .Open .Fields("ordershipshipdate") = (Me.txtOrdershipshipdate.Value) .Fields("ordershipshipdetail") = (Me.txtOrdershipshipdetail.Text) .Update .Close MsgBox "Order Details Updated Successfully!", vbInformation End With End Sub
Brian




Reply With Quote