P. 1
26623608-Stock-Maintenance-System

26623608-Stock-Maintenance-System

|Views: 1,661|Likes:
Published by astrainfo

More info:

Published by: astrainfo on Feb 08, 2011
Copyright:Attribution Non-commercial

Availability:

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

08/01/2014

pdf

text

original

Fig :6.7

CODING:

Dim date1 As Date

Dim temp, q, p As Integer

Dim db As New ADODB.Connection

Dim rs As New ADODB.Recordset

Private Sub cmddelete_Click()

Dim str As String

If (MsgBox("Are you sure you want to Delete it", vbYesNo + vbQuestion, "Stock") =

vbYes) Then

Stock maintenance system

str = "delete from Stock where itemcode='" & rs!itemcode & "'"

db.Execute str

db.Close

connectme

MsgBox "Deleted Successfully", vbOKOnly

cmbitype.Visible = True

Else

frmStockDetails.SetFocus

End If

End If

End Sub

Private Sub Command2_Click()

If (MsgBox("Are you sure you want to update the stock", vbYesNo + vbQuestion,

"Stock") = vbYes) Then

With rs

.Update "itemtype", txtitype.Text

.Update "itemcode", txticode.Text

.Update "itemname", txtiname.Text

.Update "netweight", txtnetwt.Text

.Update "date_of_entry", txtdate.Text

.Update "quantity", txtquantity.Text

.Update "price", txtprice.Text

End With

MsgBox "Stock Detail modified successfully", vbInformation + vbOKOnly, "Update"

Unload Me

frmStockDetails.Show

End If

Else

frmStockDetails.SetFocus

End Sub

Stock maintenance system

Private Sub Command1_Click()

frmpurchase.Show

End Sub

Private Sub Command3_Click()

txtitype.Visible = False

cmbitype.Visible = True

Call Reset

End Sub

Private Sub Form_Load()

connectme

MSHFlexGrid1.Visible = False

rs.Close

rs.Open "select * from stock ", db, adOpenKeyset, adLockOptimistic

Set MSHFlexGrid1.DataSource = rs

End Sub

Private Sub connectme()

Dim i As Integer, j As Integer

db.Open "arun", "scott", "tiger"

Call Resetall

rs.Open "select itemtype from stock group By itemtype ", db, adOpenKeyset,

adLockOptimistic

While rs.EOF <> True

cmbitype.AddItem rs!itemtype

rs.MoveNext

Wend

txtitype.Visible = False

End Sub

Stock maintenance system

Private Sub Command4_Click()

If MSHFlexGrid1.Visible = True Then

MSHFlexGrid1.Visible = False

txtitype.Visible = True

txticode.Visible = True

txtiname.Visible = True

txtamount.Visible = True

txtnetwt.Visible = True

txtquantity.Visible = True

txtprice.Visible = True

txtdate.Visible = True

Command2.Enabled = True

cmddelete.Enabled = True

Else

Unload Me

End If

End Sub

Private Sub cmbitype_Click()

Call Reset

rs.Close

rs.Open "select * from stock where itemtype=" & "'" & cmbitype.Text & "'", db,

adOpenKeyset, adLockOptimistic

rs.MoveFirst

cmbitype.Visible = False

txtitype.Visible = True

With rs

txtitype = !itemtype

txticode = !itemcode

txtiname.Text = !itemname

Stock maintenance system

txtnetwt.Text = !netweight

txtdate.Text = !date_of_entry

txtquantity.Text = !quantity

txtprice.Text = !price

p = txtprice.Text

q = txtquantity.Text

txtamount.Text = p * q

End With

End Sub

Public Sub Resetall()

cmbitype.Clear

txticode.Text = ""

txtiname.Text = ""

txtnetwt.Text = ""

txtquantity.Text = ""

txtdate.Text = ""

txtprice.Text = ""

End Sub

Private Sub cmdfirst_Click()

txticode.Visible = True

On Error GoTo Err

cmdNext.Enabled = True

cmdLast.Enabled = True

rs.MoveFirst

Display

cmdPrev.Enabled = False

cmdFIrst.Enabled = False

Err:

If Err.Number = 3021 Then

Stock maintenance system

MsgBox "NO CURRENT RECORD"

cmdNext.Enabled = False

cmdLast.Enabled = False

cmdPrev.Enabled = False

cmdFIrst.Enabled = False

End If

End Sub

Private Sub cmdlast_Click()

txticode.Visible = True

On Error GoTo Err

cmdFIrst.Enabled = True

cmdPrev.Enabled = True

rs.MoveLast

Display

cmdNext.Enabled = False

cmdLast.Enabled = False

Err:

If Err.Number = 3021 Then

MsgBox "NO CURRENT RECORD"

cmdNext.Enabled = False

cmdLast.Enabled = False

cmdPrev.Enabled = False

cmdFIrst.Enabled = False

End If

End Sub

Private Sub cmdnext_Click()

txticode.Visible = True

On Error GoTo Err

If rs.BOF <> True And rs.EOF <> True Then

Stock maintenance system

cmdFIrst.Enabled = True

cmdPrev.Enabled = True

rs.MoveNext

Display

Else

rs.MoveLast

Display

cmdNext.Enabled = False

cmdLast.Enabled = False

End If

If Err.Number = 3021 Then

MsgBox "NO CURRENT RECORD"

cmdNext.Enabled = False

cmdLast.Enabled = False

cmdPrev.Enabled = False

cmdFIrst.Enabled = False

End If

End Sub

Private Sub cmdprev_Click()

txticode.Visible = True

On Error GoTo Err

cmdNext.Enabled = True

cmdLast.Enabled = True

If rs.BOF <> True And rs.EOF <> True Then

rs.MovePrevious

Display

Else

rs.MoveFirst

Display

cmdPrev.Enabled = False

Stock maintenance system

cmdFIrst.Enabled = False

End If

Err:

If Err.Number = 3021 Then

MsgBox "NO CURRENT RECORD"

cmdNext.Enabled = False

cmdLast.Enabled = False

cmdPrev.Enabled = False

cmdFIrst.Enabled = False

End If

End Sub

Stock maintenance system

You're Reading a Free Preview

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