Professional Documents
Culture Documents
Option Explicit
Unload Me
End Sub
'initialization
uname = UCase(txtuserName.Text)
passwd = UCase(txtPwd.Text)
Call setEmployee
'checking of users
CtrTry = CtrTry + 1
Do Until rs.EOF
Set rs = Nothing
With MDIInventory
.Enabled = True
.Show
.mnu_inven.Enabled = True
.mnu_trans.Enabled = True
.mnuLogout.Enabled = True
.mnuLogin.Enabled = False
.MNUAD.Enabled = True
End With
Load Frm_welcome
Frm_welcome.Show
Flag = True
Else
Flag = False
End If
counter = 0
Unload Me
Exit Do
Else
rs.MoveNext
counter = counter + 1
End If
Loop
Set rs = Nothing
Label3.Caption = "Access Denied!!" & " " & "You only have " & " " & 3 - CtrTry & " " & "time(s)left to
Log In"
txtuserName.Text = ""
txtPwd.Text = ""
txtuserName.SetFocus
' ctr = 0
If CtrTry = 3 Then
Unload Me
CtrTry = 0
End If
End If
'This is only for the instance, that there is no registered user in the database
Else
MsgBox "There is No current permission has been set", vbInformation, "Inventory system"
With MDIInventory
.Show
.mnu_inven.Enabled = True
.mnu_trans.Enabled = True
.mnuLogout.Enabled = True
.mnuLogin.Enabled = False
End With
Flag = True
Unload Me
End If
End Sub
WELCOME PAGE:
Option Explicit
If MsgBox("Are You Sure you want to Quit ?", vbExclamation + vbOKCancel, "Library Management
System") = vbOK Then
Unload frmLogin
Else
cancel = True
End If
End Sub
'show form
frmCustomer.Show vbModeless
End Sub
If MsgBox("Are You Sure you want to Quit ?", vbExclamation + vbOKCancel, "Library Management
System") = vbOK Then
Unload frmLogin
Unload Me
Else
Exit Sub
End If
End Sub
'show form
frmPO.Show vbModeless
End Sub
'show form
frmProducts.Show vbModeless
End Sub
'show form
frmInvoice.Show vbModeless
End Sub
'show form
frmSupplier.Show vbModeless
End Sub
Flager
End Sub
frmAbout.Show
End Sub
frmLogin.Show
End Sub
MDIInventory.Enabled = False
End Sub
frmUser.Show vbModeless
Else
str = dateNow & " " & "You are currently Log In as Guest,Permission is not allowed"
Exit Sub
End If
End Sub
End Sub
Case 2: mnu_products_Click
Case 4: mnu_customer_Click
Case 6: mnu_supplies_Click
Case 8: mnu_sales_Click
End Select
End Sub
PRODUCTS:
Option Explicit
Dim id As String
Call setProduct
rs.AddNew
With Me
rs!ProdID = .txtProduct_ID
rs!ProductDesc = .txtDesc
rs!ProductName = .txtProductName
rs!QtySold = .txtSold
rs!SRP = .txtSRP
rs!SupplierPrice = .txtUnit_Price
rs!QtyLeft = .txtINStock
rs!Suppliers = .cboSupplier
End With
rs.Update
Call Clear
Set rs = Nothing
cmdNew.Enabled = True
cmdAppend.Enabled = False
' autonum_product
End Sub
cmdAppend.Enabled = False
cmdNew.Enabled = True
End Sub
Call ItemRecord
With rs
.Delete
Call Clear
Call Clear
End If
End With
End Sub
'autonumber
autonum_product
setProduct
cmdAppend.Enabled = True
Call Clear
Set rs = Nothing
chekID (id)
cmdNew.Enabled = False
Frame1.Enabled = True
End Sub
Unload Me
End Sub
Unload Me
End Sub
setProduct
ItemRecord
rs.MoveFirst
If rs.BOF = True Then
End If
End Sub
ItemRecord
rs.MovePrevious
End If
End Sub
ItemRecord
rs.MoveNext
End If
End Sub
ItemRecord
rs.MoveLast
End If
End Sub
id = txtProduct_ID.Text
Call setSupplier
cboSupplier.AddItem rs!SupplierName
rs.MoveNext
Loop
End If
Set rs = Nothing
Call setProduct
ItemRecord
Call usergrid_Load
With usergrid
.ColWidth(0) = 200
.ColWidth(1) = 1100
.ColWidth(2) = 2000
End With
Else
Exit Sub
End If
End Sub
'connect
Exit Function
Else
MsgBox "The ID is already exist! Please Put a New ID", vbCritical, "Inventory System"
End If
End If
Set rs = Nothing
End Function
With Me
.txtDesc = ""
.txtProductName = ""
.txtSold = ""
.txtSRP = ""
.txtUnit_Price = ""
.txtINStock = ""
End With
End Sub
setProduct
With Me
.txtProduct_ID = rs!ProdID
.txtProductName = rs!ProductName
.txtSold = rs!QtySold
.txtSRP = rs!SRP
.txtUnit_Price = rs!SupplierPrice
.txtINStock = rs!QtyLeft
.cboSupplier = rs!Suppliers
End With
setProduct
End Sub
If rs.RecordCount = 0 Then
txtProduct_ID.Text = "P-0001"
Else
End If
rs.Close
Set rs = Nothing
txtProduct_ID.Locked = True
End Function
Set usergrid.DataSource = rs
Set rs = Nothing
End Function
CUSTOMER:
Unload Me
End Sub
Cust
rs.Delete
rs.MoveNext
Clear
End Sub
rs.Clone
Cust2
rs.Update
End Sub
Cust
Clear
rs.AddNew
With Me
.cmdEdit.Enabled = False
.cmdDelete.Enabled = False
.cmdNew.Enabled = False
.cmdCancel.Enabled = True
End With
End Sub
rs.Update
Clear
cmdSave.Enabled = False
End Sub
Unload Me
End Sub
Cust
With rs
.MoveNext
rs.MovePrevious
End If
End With
End Sub
Cust
With rs
.MovePrevious
If rs.BOF = True Then
rs.MoveNext
End If
End With
End Sub
Cust
With rs
.MoveFirst
End With
End Sub
Cust
With rs
.MoveLast
End With
End Sub
Call Cust
End If
usergrid_Load
End Sub
With Me
.txtCust = rs!CustomerName
.txtAd = rs!Address
.txtCon2 = rs!ContactNumber
.txtE2 = rs!Email
End With
End Sub
With Me
rs!CustomerName = .txtCust
rs!Address = .txtAd
rs!ContactNumber = .txtCon2
rs!Email = .txtE2
End With
End Sub
.txtCust = ""
.txtAd = ""
.txtCon2 = ""
.txtE2 = ""
End With
End Sub
Dim X As Integer
X = usergrid.Row
With usergrid
txtCust.Text = .TextMatrix(X, 1)
txtAd.Text = .TextMatrix(X, 2)
txtCon2.Text = .TextMatrix(X, 3)
txtE2.Text = .TextMatrix(X, 4)
End With
End Sub
Set usergrid.DataSource = rs
End Function
SUPPLIER:
Private Sub Command1_Click()
setSupplier
Clear
rs.AddNew
Set DataGrid1.DataSource = rs
DataGrid1.Refresh
Command2.Enabled = True
End Sub
supp1
rs.Update
Clear
End Sub
Unload Me
End Sub
Call supp
With rs
.MoveNext
rs.MovePrevious
End If
End With
End Sub
Call supp
With rs
.MovePrevious
rs.MoveNext
End If
End With
End Sub
Call supp
With rs
.MoveFirst
If rs.BOF = True Then
rs.MoveNext
End If
End With
End Sub
Call supp
With rs
.MoveLast
rs.MovePrevious
End If
End With
End Sub
Set DataGrid1.DataSource = rs
DataGrid1.Refresh
Call supp
supp1
End If
Command2.Enabled = False
End Sub
With Me
.txtSupp = rs!SupplierName
.txtC = rs!ContactName
.txtAd = rs!Address
.txtNum = rs!ContactNumber
.txtE = rs!Email
End With
End Sub
With Me
rs!SupplierName = .txtSupp
rs!ContactName = .txtC
rs!Address = .txtAd
rs!ContactNumber = .txtNum
rs!Email = .txtE
End With
End Sub
Public Sub Clear()
With Me
.txtSupp = ""
.txtC = ""
.txtAd = ""
.txtNum = ""
.txtE = ""
End With
End Sub
USER:
uID = UCase(txtUsrID.Text)
pswd = UCase(txtPwd.Text)
setEmployee
rs.AddNew
rs!UserName = uID
rs!Password = pswd
rs.Update
MsgBox txtUsrID.Text & " " & "has been save!", vbInformation
Set DataGrid1.DataSource = rs
DataGrid1.Refresh
Call locate
txtUsrID.Text = ""
txtPwd.Text = ""
With Me
.cmdEdit.Enabled = True
.cmdDelete.Enabled = True
.cmdQuit.Enabled = True
.cmdCancel.Enabled = False
.cmdNew.Enabled = True
End With
End Sub
With Me
.cmdAppend.Enabled = False
.cmdEdit.Enabled = True
.cmdDelete.Enabled = True
.cmdQuit.Enabled = True
.cmdNew.Enabled = True
End With
cmdNew.Enabled = True
txtUsrID.Text = ""
txtPwd.Text = ""
txtUsrID.Locked = False
txtPwd.Locked = False
End Sub
With Me
.txtPwd = rs!Password
.txtUsrID = rs!UserName
End With
'
If MsgBox("Are You Sure you want to Delete this?", vbExclamation + vbOKCancel, "Library
Management System") = vbOK Then
rs.Delete
Set DataGrid1.DataSource = rs
DataGrid1.Refresh
txtUsrID.Text = ""
txtPwd.Text = ""
Else
Exit Sub
End If
If rs.RecordCount = 0 Then
End If
End Sub
uID = UCase(txtUsrID.Text)
pswd = UCase(txtPwd.Text)
txtPwd.Enabled = True
txtUsrID.Enabled = True
With Me
.cmdDelete.Enabled = False
.cmdNew.Enabled = False
.cmdAppend.Enabled = False
End With
cmdEdit.Caption = "SAVE"
rs.Clone
rs!UserName = uID
rs!Password = pswd
Set usergrid.DataSource = rs
usergrid.Refresh
rs.Update
cmdEdit.Caption = "&Edit"
With Me
.cmdDelete.Enabled = True
.cmdNew.Enabled = True
End With
End If
End Sub
txtUsrID.Enabled = True
txtPwd.Enabled = True
txtUsrID.Text = ""
txtPwd.Text = ""
cmdAppend.Enabled = True
ctrl_Flag = False
With Me
.cmdEdit.Enabled = False
.cmdDelete.Enabled = False
.cmdQuit.Enabled = False
.cmdNew.Enabled = False
.cmdCancel.Enabled = True
End With
End Sub
Unload Me
End Sub
setEmployee
Call usergrid_Load
With usergrid
.ColWidth(0) = 200
.ColWidth(1) = 1100
.ColWidth(2) = 2000
End With
Call showdata
Call locate
End Sub
Public Sub locate()
Label9.Caption = rs.RecordCount
Label6.Caption = rs.AbsolutePosition
End Sub
setEmployee
With Me
.txtPwd.Text = rs!Password
.txtUsrID.Text = rs!UserName
Call locate
End With
End If
End Sub
Dim X As Integer
X = usergrid.Row
With usergrid
txtUsrID.Text = .TextMatrix(X, 1)
txtPwd.Text = .TextMatrix(X, 2)
End With
End Sub
Set usergrid.DataSource = rs
Set rs = Nothing
End Function
PURCHASE ORDER:
Option Explicit
Sql = "Select * from Product where Suppliers='" & cboSupplier.Text & "'"
grdProduct.Enabled = True
Set grdProduct.DataSource = rs
grdProduct.Refresh
Set rs = Nothing
End If
End Sub
frmAdd.Show
With frmAdd
.Label2.Caption = SuppID
.Label4.Caption = itemAdd
End With
Command1.Enabled = False
lblStat.Caption = listP.ListItems.Count
End Sub
PO_ID = UCase(txtPO.Text)
SupID = cboSupplier.Text
DateOr = DPDate_Order.Value
DateRe = DPDate_Required.Value
CheckDuplication (PO_ID)
For i = 1 To listP.ListItems.Count
Supplier = listP.ListItems(i).Text
Quantity = listP.ListItems(i).ListSubItems(2).Text
"Values('" & PO_ID & "','" & Supplier & "','" & Quantity & "','" & SupID & "','" & DateOr & "','" &
DateRe & "')"
Next
listP.ListItems.Clear
MsgBox " Transaction No " & PO_ID & " has been purchased.", vbInformation, "Inventory system"
Call AutoID
End Sub
Exit Function
Else
End If
End If
Set rs = Nothing
End Function
If rs.RecordCount = 0 Then
txtPO.Text = "PO-0000"
Else
End If
rs.Close
Set rs = Nothing
txtPO.Locked = True
End Function
Unload Me
End Sub
With grdProduct
.ColWidth(0) = 300
.ColWidth(1) = 1500
.ColWidth(2) = 2500
.ColWidth(3) = 2500
.ColWidth(6) = 1400
.Enabled = False
End With
Set rs = Nothing
Call AutoID
setSupplier
Do Until rs.EOF
cboSupplier.AddItem rs!SupplierName
rs.MoveNext
Loop
End If
lblStat.Caption = listP.ListItems.Count
Set rs = Nothing
End Sub
With Me
.cboSupplier.Text = ""
.txtPO.Text = ""
End With
End Sub
i = grdProduct.Row
With grdProduct
lblItemName.Caption = .TextMatrix(i, 2)
SuppID = .TextMatrix(i, 1)
itemAdd = .TextMatrix(i, 2)
End With
Command1.Enabled = True
End If
End Sub
INVOICE:
rs.Open "select * from Product where ProductName='" & cboProducts.Text & "'", cn, 3, 3
grdproduct.Enabled = True
txts.Text = rs!SRP
Set grdproduct.DataSource = rs
grdproduct.Refresh
End If
Set rs = Nothing
End Sub
Private Sub Command1_Click()
With frmSell
.Label2.Caption = poAd
.Label4.Caption = itemAd
End With
frmSell.Show
End Sub
Unload Me
End Sub
With grdproduct
.ColWidth(0) = 300
.ColWidth(1) = 1500
.ColWidth(2) = 2500
.ColWidth(3) = 2500
.ColWidth(6) = 1400
.Enabled = False
End With
End If
Set rs = Nothing
setCustomer
Do Until rs.EOF
cboCustomer.AddItem rs!CustomerName
rs.MoveNext
Loop
End If
Set rs = Nothing
setProduct
Do Until rs.EOF
cboProducts.AddItem rs!ProductName
rs.MoveNext
Loop
End If
Set rs = Nothing
End Sub
With grdproduct
poAd = .TextMatrix(i, 1)
itemAd = .TextMatrix(i, 2)
End With
End Sub