Pro-care-nursing-home-11-12 part 3

12. Double Click on the cmdSave button and write codes in between cmdSave_Click ( ) event procedure.

Private Sub cmdSave_Click( )
AdoPatient.Recordset.Update
Msgbox("Your record has been saved now")
End Sub

13. Double Click on the cmdDelete button and write codes in between cmdDelete_Click ( ) event procedure.

Private Sub cmdDelete_Click( )
AdoPatient.Recordset.Delete
AdoPatient.Recordset.MoveNext
msgbox("Your record has been deleted now")
End Sub

14. Now add a new Form Control. Change Form Name property to “frmBill”, Caption
property to "Bill", BorderStyle property to “1-FixedSingle”, StartupPosition to "2-
CenterScreen" and Icon to "Any Icon".

15. Add ADODC control the frmBill Form, Change its Name property to AdoBill.

16. Now right click on it using mouse and select ADODC Properties. Now click Build Button select
Microsoft OLE DB Provider for Oracle from the list, Click Next button, Enter User name scott
& Password tiger, Check Allow saving Password Checkbox and Click Test Connection, Click Ok.
Now move to RecordSource tab then select Command Type to 2-adCmdTable Now select
Table or Stored Procedure Name to BILL (Table Created before) and Click Ok Button.

17. Add following controls to the Form (frmBill) control with following properties settings:

Sr. No
Control
Properties
Settings
1
Label
Caption
BillNo
2
Label
Caption
BadNo
3
Label
Caption
Amount
4
Textbox
Name
txtBillno


Text
Blank


DataSource
AdoBill


DataField
ID
5
Textbox
Name
txtBadno


Text
Blank


DataSource
AdoBill


DataField
NAME
6
Textbox
Name
txtAmount


Text
Blank


DataSource
AdoBill


DataField
DOB
7
CommandButton
Name
cmdAdd


Caption
&Add
8
CommandButton
Name
cmdSave


Caption
&Save
9
CommandButton
Name
cmdDelete


Caption
&Delete

18. Double Click on the cmdAdd button and write codes in between cmdAdd_Click ( ) event procedure.

Private Sub cmdAdd_Click( )
AdoBill.Recordset.AddNew
txtBillno.Setfocus
End Sub