Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
code

code

Ratings: (0)|Views: 7 |Likes:
Published by api-3697508

More info:

Published by: api-3697508 on Nov 21, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as TXT, PDF, TXT or read online from Scribd
See more
See less

03/18/2014

pdf

text

original

**************************
CODE FOR STOCK FORM
**************************
Private Sub Command1_Click()
Dim avail_stock As Integer
rs.Find "pcode=" & Val(Text1.Text), , adSearchForward, 1

If (rs.EOF = True) Then
rs.AddNew
rs("pcode") = Val(Text1.Text)
rs("pname") = Text2.Text
rs("totalstock") = Val(Text3.Text)
rs.Update
MsgBox "Record Inserted", vbExclamation, "Inventory System"

Else
avail_stock = rs("totalstock")
rs("totalstock") = avail_stock + Val(Text3.Text)
rs.Update

MsgBox "Record updated", vbExclamation, "Inventory System"
End If
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub
Private Sub Command2_Click()

rs("pcode") = Val(Text1.Text)
rs("pname") = Text2.Text
rs("totalstock") = Val(Text3.Text)
rs.Update
MsgBox "Record updated", vbExclamation, "Inventory System"

End Sub

Private Sub Command3_Click()
rs.Delete
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
MsgBox "Record deleted", vbExclamation, "Inventory System"
End Sub

Private Sub Command4_Click()
Dim product_code
product_code = InputBox("Enter the product code", "Inventory system")
rs.Find "pcode=" & product_code, , adSearchForward, 1
If (rs.EOF = True) Then

MsgBox "Record Not Found", vbCritical, "Inventory System"

Else
Text1.Text = rs("pcode")
Text2.Text = rs("pname")
Text3.Text = rs("totalstock")

End If
End Sub

Private Sub Command5_Click()
rs.MoveNext
If (rs.EOF = True) Then

MsgBox "End of File Reached"
rs.MoveLast

Else
Text1.Text = rs("pcode")
Text2.Text = rs("pname")
Text3.Text = rs("totalstock")

End If
End Sub
Private Sub Command6_Click()

rs.MovePrevious

If (rs.BOF = True) Then
MsgBox "Begining of File Reached"
rs.MoveFirst

Else
Text1.Text = rs("pcode")
Text2.Text = rs("pname")
Text3.Text = rs("totalstock")

End If
End Sub

Private Sub Command7_Click()
rs.MoveFirst
Text1.Text = rs("pcode")

Text2.Text = rs("pname")
Text3.Text = rs("totalstock")
End Sub

Private Sub Command8_Click()
rs.MoveLast
Text1.Text = rs("pcode")

Text2.Text = rs("pname")
Text3.Text = rs("totalstock")
End Sub

Private Sub Command9_Click()
Unload Me
Form1.Show
End Sub

**************************
CODE FOR SALES FORM

**************************
Private Sub Command1_Click()
Dim avail_stock As Integer, total_stock As Integer

stockrs.Find "pcode=" & Text2.Text
If (stockrs.EOF = True) Then
MsgBox "Productcode Not Found", vbCritical, "Inventory System"

Else
total_stock = stockrs("totalstock")
avail_stock = total_stock - Val(Text4.Text)
If (avail_stock <= 0) Then

MsgBox "Insufficient stock", vbCritical, "Inventory System"
Text4.SetFocus

Else
salesrs.AddNew
Call move_data2salestable
salesrs.Update
MsgBox "Record Inserted into sales table", vbExclamation, "Inventory System"

'the following code update the stock table
stockrs("totalstock") = avail_stock
stockrs.Update
MsgBox "Stock table updated", vbExclamation, "Inventory System"
Call clearformfields

End If
End If
End Sub

Public Sub clearformfields()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""

End Sub

Private Sub Command2_Click()
Call move_data2salestable
salesrs.Update
MsgBox "Record Updated", vbExclamation, "Inventory System"

End Sub

Public Sub move_data2salestable()
salesrs("customer_id") = Val(Text1.Text)
salesrs("date1") = DTPicker1.Value
salesrs("pcode") = Val(Text2.Text)
salesrs("pname") = Text3.Text
salesrs("nitem") = Val(Text4.Text)
salesrs("uprice") = Val(Text5.Text)
salesrs("tprice") = Val(Text6.Text)

End Sub

Private Sub Command3_Click()
salesrs.Delete
Call clearformfields
MsgBox "Record deleted", vbExclamation, "Inventory System"

End Sub

Private Sub Command4_Click()
Dim customerid
customerid = InputBox("Enter the Customer_id", "Inventory system")
salesrs.Find "Customer_id=" & customerid, , adSearchForward, 1

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->