Option Explicit

Dim C As New Connection
Dim R As New Recordset
Dim S As String
Dim tot As Integer
Private Sub cmdAdd_Click()
txtPcode.Text = ""
txtPname.Text = ""
txtQty.Text = ""
txtPrice.Text = ""
txtTotal.Text = ""
txtPcode.SetFocus
End Sub

Private Sub cmdNext_Click()
R.MoveNext
If Not R.EOF Then
txtPcode.Text = R.Fields(0).Value
txtPname.Text = R.Fields(1).Value
txtQty.Text = R.Fields(2).Value
txtPrice.Text = R.Fields(3).Value
txtTotal.Text = R.Fields(4).Value
Else
MsgBox "No More Records!", vbInformation, "Product"
End If
End Sub
Private Sub cmdPrev_Click()
R.MovePrevious
If Not R.BOF Then
txtPcode.Text = R.Fields(0).Value
txtPname.Text = R.Fields(1).Value
txtQty.Text = R.Fields(2).Value
txtPrice.Text = R.Fields(3).Value
txtTotal.Text = R.Fields(4).Value
Else
MsgBox "No More Records!", vbInformation, "Product"
End If
End Sub
Private Sub cmdSave_Click()
R.Close
S = "Insert Into prodData Values(" & Val(txtPcode.Text) & ",'" & txtPname.Text & "'," & Val(txtQty.Text) & ", " & Val(txtPrice.Text) & "," & Val(txtTotal.Text) & ")"
R.Open S, C, adOpenDynamic, adLockOptimistic
S = "Select * From prodData"
R.Open S, C, adOpenDynamic, adLockOptimistic
If Not R.BOF And Not R.EOF Then
R.MoveFirst
txtPcode.Text = R.Fields(0).Value
txtPname.Text = R.Fields(1).Value
txtQty.Text = R.Fields(2).Value
txtPrice.Text = R.Fields(3).Value
txtTotal.Text = R.Fields(4).Value
End If
MsgBox "Product Added Successfully!", vbInformation, "Product"
End Sub
Private Sub cmdUpdate_Click()
R.Close
If txtPcode.Text = 100 Then
S = "Update prodData Set pno = '" & txtPname.Text & "', pname = '" & txtPname.Text & "',qty=" & Val(txtQty.Text) & ",price=" & Val(txtPrice.Text) & "',totalprice=" & Val(txtTotal.Text) & " Where pno = " & Val(txtPcode.Text)
R.Open S, C, adOpenDynamic, adLockOptimistic
S = "Select * From prodData"
R.Open S, C, adOpenDynamic, adLockOptimistic
If Not R.BOF And Not R.EOF Then
R.MoveFirst
txtPcode.Text = R.Fields(0).Value
txtPname.Text = R.Fields(1).Value
txtQty.Text = R.Fields(2).Value
txtPrice.Text = R.Fields(3).Value
txtTotal.Text = R.Fields(4).Value
End If
MsgBox "Product Updated Successfully!", vbInformation, "Product"
Else
S = "Select * From prodData"
R.Open S, C, adOpenDynamic, adLockOptimistic
If Not R.BOF And Not R.EOF Then
R.MoveFirst
txtPcode.Text = R.Fields(0).Value
txtPname.Text = R.Fields(1).Value
txtQty.Text = R.Fields(2).Value
txtPrice.Text = R.Fields(3).Value
txtTotal.Text = R.Fields(4).Value
End If
MsgBox "Product Not updated!", vbInformation, "Product"
End If
End Sub

Private Sub Form_Load()
S = "Select * From prodData"
C.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\VBSlipSol\Slip13\Ques-2\prod.mdb;Persist Security Info=False"
R.Open S, C, adOpenDynamic, adLockOptimistic
If Not R.BOF And Not R.EOF Then
R.MoveFirst
txtPcode.Text = R.Fields(0).Value
txtPname.Text = R.Fields(1).Value
txtQty.Text = R.Fields(2).Value
txtPrice.Text = R.Fields(3).Value
txtTotal.Text = R.Fields(4).Value
End If
End Sub

Private Sub txtPrice_Change()
txtTotal = Val(txtQty.Text) * Val(txtPrice.Text)
End Sub

Search

Project Categories

Recent Posts

Mail Management System
Posted on 2019-07-18
Online food ordering system
Posted on 2019-07-18
Library Management System
Posted on 2019-07-17
Health center system project
Posted on 2019-07-17
Gym Management System
Posted on 2019-07-17
furniture management system
Posted on 2019-07-17
Electronic shop management system
Posted on 2019-07-17
Automobile Workshop Management
Posted on 2019-07-17
Online Visa Processing System
Posted on 2019-07-17
Inventory management System
Posted on 2019-07-17
petrol-management system
Posted on 2019-07-17
Cloths management system
Posted on 2019-07-17
Society Management system
Posted on 2019-07-17
Mall management system
Posted on 2019-07-17
school management system
Posted on 2019-07-17
Sales Order Processing System
Posted on 2019-07-17
Retail sales management
Posted on 2019-07-17
Raw Materials Management
Posted on 2019-07-17
railway reservation system
Posted on 2019-07-17
purchase and sales management system
Posted on 2019-07-17
Placement Management System
Posted on 2019-07-17
Pet Shop Management System
Posted on 2019-07-17
petrol pump management system
Posted on 2019-07-17
Patient Information System
Posted on 2019-07-17
news agency system
Posted on 2019-07-17
Cinema Booking System
Posted on 2019-07-17
Medical Store System
Posted on 2019-07-17
leave management System
Posted on 2019-07-17
Laboratory Information Management System
Posted on 2019-07-17
content management system
Posted on 2019-07-17
Inventory management System
Posted on 2019-07-17
Institute Management System
Posted on 2019-07-17
Hotel management System
Posted on 2019-07-17
Gym Management System
Posted on 2019-07-17
Garage Management System
Posted on 2019-07-17
Furniture shop management system
Posted on 2019-07-17
Fisheries management  System
Posted on 2019-07-17
Fertilizer scheduling system
Posted on 2019-07-17
online eye care system
Posted on 2019-07-17
Dental Clinic Management System
Posted on 2019-07-17
Cyber Café Management
Posted on 2019-07-17
Milk Billing System
Posted on 2019-07-17
Colddrink management system
Posted on 2019-07-17
Cable management System
Posted on 2019-07-17
Beauty parlor management system
Posted on 2019-07-17
Facebook Clone
Posted on 2019-05-28
Dance Class Management System
Posted on 2019-05-24
Library Management System
Posted on 2019-05-24
Cab Management System
Posted on 2019-05-23
Blood Bank Management system
Posted on 2019-05-23
Beauty Parlour Management System
Posted on 2019-05-23
vissa proccesing system
Posted on 2019-05-23
Toll Plazza
Posted on 2019-05-23
BILLING APPLICATION
Posted on 2019-05-23
FLORICULTURE MANAGEMENT SYSTEM
Posted on 2019-05-23
Car On Rent
Posted on 2019-05-23
E-commers Shop
Posted on 2019-05-23

Sign In