i make a table
1.Add= =Now(), 2. modify (in main form default value is =Now()), 3.Action =Text (in add Form default value is ‘Add’ and in Modify main Form ‘Modify’) 4. ID=Auto number 5. Description=tex t, 6. VchSeries=text, 7. VchNo=text, 8. Dateoftransacti on=Date
9. Debitaccount=te xt 10. CreditAccount=t ext 11. Amount=number 12. Narration=text 13. shortNarration =Text
Modify
1.Add= =Now(), 2. modify (in main form default value is =Now()), 3.Action =Text (in add Form default value is ‘Add’ and in Modify main Form ‘Modify’) 4. ID=Auto number 5. Description=tex t, 6. VchSeries=text, 7. VchNo=text, 8. Dateoftransacti on=Date
9. Debitaccount=te xt 10. CreditAccount=t ext 11. Amount=number 12. Narration=text 13. shortNarration =Text
Code:
Private Sub Save_Click()
On Error Resume Next
'add data to table
CurrentDb.Execute "INSERT INTO 6_Transaction (Add, Action, Description, VchSeries, VchNo, Dateoftransaction, Debitaccount, Narration, Creditaccount, Amount)" & _
"VALUES (# " & Me.txtAdd & " # , '" & Me.txtAction & "' , '" & Me.cboDiscraption & "' , '" & Me.cboSeries & "' , '" & Me.txtVchNo & "' , # " & Me.txtDate & " # , '" & Me.cboParty & "' , '" & Me.txtNaration & "' , '" & [Form1]!cboAccount & "' , " & [Form1]!txtDebit & ")"
'add data to table
CurrentDb.Execute "INSERT INTO 6_Transaction (Add, Action, Description, VchSeries, VchNo, Dateoftransaction, Debitaccount, Narration, Creditaccount, Amount)" & _
"VALUES (# " & Me.txtAdd & " # , '" & Me.txtAction & "' , '" & Me.cboDiscraption & "' , '" & Me.cboSeries & "' , '" & Me.txtVchNo & "' , # " & Me.txtDate & " # , '" & Me.cboParty & "' , '" & Me.txtNaration & "' , '" & [Form1]!cboAccount1 & "' , " & [Form1]!txtDebit1 & ")"
'add data to table
CurrentDb.Execute "INSERT INTO 6_Transaction (Add, Action, Description, VchSeries, VchNo, Dateoftransaction, Debitaccount, Narration, Creditaccount, Amount)" & _
"VALUES (# " & Me.txtAdd & " # , '" & Me.txtAction & "' , '" & Me.cboDiscraption & "' , '" & Me.cboSeries & "' , '" & Me.txtVchNo & "' , # " & Me.txtDate & " # , '" & Me.cboParty & "' , '" & Me.txtNaration & "' , '" & [Form1]!cboAccount2 & "' , " & [Form1]!txtDebit2 & ")"
'add data to table
CurrentDb.Execute "INSERT INTO 6_Transaction (Add, Action, Description, VchSeries, VchNo, Dateoftransaction, Debitaccount, Narration, Creditaccount, Amount)" & _
"VALUES (# " & Me.txtAdd & " # , '" & Me.txtAction & "' , '" & Me.cboDiscraption & "' , '" & Me.cboSeries & "' , '" & Me.txtVchNo & "' , # " & Me.txtDate & " # , '" & Me.cboParty & "' , '" & Me.txtNaration & "' , '" & [Form1]!cboAccount3 & "' , " & [Form1]!txtDebit3 & ")"
'add data to table
CurrentDb.Execute "INSERT INTO 6_Transaction (Add, Action, Description, VchSeries, VchNo, Dateoftransaction, Debitaccount, Narration, Creditaccount, Amount)" & _
"VALUES (# " & Me.txtAdd & " # , '" & Me.txtAction & "' , '" & Me.cboDiscraption & "' , '" & Me.cboSeries & "' , '" & Me.txtVchNo & "' , # " & Me.txtDate & " # , '" & Me.cboParty & "' , '" & Me.txtNaration & "' , '" & [Form1]!cboAccount4 & "' , " & [Form1]!txtDebit4 & ")"
'add data to table
CurrentDb.Execute "INSERT INTO 6_Transaction (Add, Action, Description, VchSeries, VchNo, Dateoftransaction, Debitaccount, Narration, Creditaccount, Amount)" & _
"VALUES (# " & Me.txtAdd & " # , '" & Me.txtAction & "' , '" & Me.cboDiscraption & "' , '" & Me.cboSeries & "' , '" & Me.txtVchNo & "' , # " & Me.txtDate & " # , '" & Me.cboParty & "' , '" & Me.txtNaration & "' , '" & [Form1]!cboAccount5 & "' , " & [Form1]!txtDebit5 & ")"
'add data to table
CurrentDb.Execute "INSERT INTO 6_Transaction (Add, Action, Description, VchSeries, VchNo, Dateoftransaction, Debitaccount, Narration, Creditaccount, Amount)" & _
"VALUES (# " & Me.txtAdd & " # , '" & Me.txtAction & "' , '" & Me.cboDiscraption & "' , '" & Me.cboSeries & "' , '" & Me.txtVchNo & "' , # " & Me.txtDate & " # , '" & Me.cboParty & "' , '" & Me.txtNaration & "' , '" & [Form1]!cboAccount6 & "' , " & [Form1]!txtDebit6 & ")"
'add data to table
CurrentDb.Execute "INSERT INTO 6_Transaction (Add, Action, Description, VchSeries, VchNo, Dateoftransaction, Debitaccount, Narration, Creditaccount, Amount)" & _
"VALUES (# " & Me.txtAdd & " # , '" & Me.txtAction & "' , '" & Me.cboDiscraption & "' , '" & Me.cboSeries & "' , '" & Me.txtVchNo & "' , # " & Me.txtDate & " # , '" & Me.cboParty & "' , '" & Me.txtNaration & "' , '" & [Form1]!cboAccount7 & "' , " & [Form1]!txtDebit7 & ")"
'add data to table
CurrentDb.Execute "INSERT INTO 6_Transaction (Add, Action, Description, VchSeries, VchNo, Dateoftransaction, Debitaccount, Narration, Creditaccount, Amount)" & _
"VALUES (# " & Me.txtAdd & " # , '" & Me.txtAction & "' , '" & Me.cboDiscraption & "' , '" & Me.cboSeries & "' , '" & Me.txtVchNo & "' , # " & Me.txtDate & " # , '" & Me.cboParty & "' , '" & Me.txtNaration & "' , '" & [Form1]!cboAccount8 & "' , " & [Form1]!txtDebit8 & ")"
'add data to table
CurrentDb.Execute "INSERT INTO 6_Transaction (Add, Action, Description, VchSeries, VchNo, Dateoftransaction, Debitaccount, Narration, Creditaccount, Amount)" & _
"VALUES (# " & Me.txtAdd & " # , '" & Me.txtAction & "' , '" & Me.cboDiscraption & "' , '" & Me.cboSeries & "' , '" & Me.txtVchNo & "' , # " & Me.txtDate & " # , '" & Me.cboParty & "' , '" & Me.txtNaration & "' , '" & [Form1]!cboAccount9 & "' , " & [Form1]!txtDebit9 & ")"
'add data to table
CurrentDb.Execute "INSERT INTO 6_Transaction (Add, Action, Description, VchSeries, VchNo, Dateoftransaction, Debitaccount, Narration, Creditaccount, Amount)" & _
"VALUES (# " & Me.txtAdd & " # , '" & Me.txtAction & "' , '" & Me.cboDiscraption & "' , '" & Me.cboSeries & "' , '" & Me.txtVchNo & "' , # " & Me.txtDate & " # , '" & Me.cboParty & "' , '" & Me.txtNaration & "' , '" & [Form1]!cboAccount10 & "' , " & [Form1]!txtDebit10 & ")"
'add data to table
CurrentDb.Execute "INSERT INTO 6_Transaction (Add, Action, Description, VchSeries, VchNo, Dateoftransaction, Debitaccount, Narration, Creditaccount, Amount)" & _
"VALUES (# " & Me.txtAdd & " # , '" & Me.txtAction & "' , '" & Me.cboDiscraption & "' , '" & Me.cboSeries & "' , '" & Me.txtVchNo & "' , # " & Me.txtDate & " # , '" & Me.cboParty & "' , '" & Me.txtNaration & "' , '" & [Form1]!cboAccount11 & "' , " & [Form1]!txtDebit11 & ")"
'add data to table
CurrentDb.Execute "INSERT INTO 6_Transaction (Add, Action, Description, VchSeries, VchNo, Dateoftransaction, Debitaccount, Narration, Creditaccount, Amount)" & _
"VALUES (# " & Me.txtAdd & " # , '" & Me.txtAction & "' , '" & Me.cboDiscraption & "' , '" & Me.cboSeries & "' , '" & Me.txtVchNo & "' , # " & Me.txtDate & " # , '" & Me.cboParty & "' , '" & Me.txtNaration & "' , '" & [Form1]!cboAccount12 & "' , " & [Form1]!txtDebit12 & ")"
'add data to table
CurrentDb.Execute "INSERT INTO 6_Transaction (Add, Action, Description, VchSeries, VchNo, Dateoftransaction, Debitaccount, Narration, Creditaccount, Amount)" & _
"VALUES (# " & Me.txtAdd & " # , '" & Me.txtAction & "' , '" & Me.cboDiscraption & "' , '" & Me.cboSeries & "' , '" & Me.txtVchNo & "' , # " & Me.txtDate & " # , '" & Me.cboParty & "' , '" & Me.txtNaration & "' , '" & [Form1]!cboAccount13 & "' , " & [Form1]!txtDebit13 & ")"
'add data to table
CurrentDb.Execute "INSERT INTO 6_Transaction (Add, Action, Description, VchSeries, VchNo, Dateoftransaction, Debitaccount, Narration, Creditaccount, Amount)" & _
"VALUES (# " & Me.txtAdd & " # , '" & Me.txtAction & "' , '" & Me.cboDiscraption & "' , '" & Me.cboSeries & "' , '" & Me.txtVchNo & "' , # " & Me.txtDate & " # , '" & Me.cboParty & "' , '" & Me.txtNaration & "' , '" & [Form1]!cboAccount14 & "' , " & [Form1]!txtDebit14 & ")"
'add data to table
CurrentDb.Execute "INSERT INTO 6_Transaction (Add, Action, Description, VchSeries, VchNo, Dateoftransaction, Debitaccount, Narration, Creditaccount, Amount)" & _
"VALUES (# " & Me.txtAdd & " # , '" & Me.txtAction & "' , '" & Me.cboDiscraption & "' , '" & Me.cboSeries & "' , '" & Me.txtVchNo & "' , # " & Me.txtDate & " # , '" & Me.cboParty & "' , '" & Me.txtNaration & "' , '" & [Form1]!cboAccount15 & "' , " & [Form1]!txtDebit15 & ")"
'add data to table
CurrentDb.Execute "INSERT INTO 6_Transaction (Add, Action, Description, VchSeries, VchNo, Dateoftransaction, Debitaccount, Narration, Creditaccount, Amount)" & _
"VALUES (# " & Me.txtAdd & " # , '" & Me.txtAction & "' , '" & Me.cboDiscraption & "' , '" & Me.cboSeries & "' , '" & Me.txtVchNo & "' , # " & Me.txtDate & " # , '" & Me.cboParty & "' , '" & Me.txtNaration & "' , '" & [Form1]!cboAccount16 & "' , " & [Form1]!txtDebit16 & ")"
'add data to table
CurrentDb.Execute "INSERT INTO 6_Transaction (Add, Action, Description, VchSeries, VchNo, Dateoftransaction, Debitaccount, Narration, Creditaccount, Amount)" & _
"VALUES (# " & Me.txtAdd & " # , '" & Me.txtAction & "' , '" & Me.cboDiscraption & "' , '" & Me.cboSeries & "' , '" & Me.txtVchNo & "' , # " & Me.txtDate & " # , '" & Me.cboParty & "' , '" & Me.txtNaration & "' , '" & [Form1]!cboAccount17 & "' , " & [Form1]!txtDebit17 & ")"
DoCmd.RunCommand acCmdClose
DoCmd.OpenForm "FrmSaleAdd"
End Sub
Code:
Private Sub Command192_Click()
'check whether there data in list
If Not (Me.QryNewCaseQuery_subform.Form.Recordset.EOF And Me.QryNewCaseQuery_subform.Form.Recordset.BOF) Then
'get data to text box
With Me.QryNewCaseQuery_subform.Form.Recordset
Me.txtAdd = .Fields("Add")
Me.cboDiscraption = .Fields("Description")
Me.cboSeries = .Fields("VchSeries")
Me.txtDate = .Fields("DateofTransaction")
Me.cboParty = .Fields("Debitaccount")
Me.txtNaration = .Fields("Narration")
[Form1]!cboAccount = .Fields("Creditaccount")
End With
End If
Comment