Results 1 to 4 of 4
  1. #1

    Default need help to UPDATE in vb..


    basin naa moy ma hatag code para pag update... wah pa man jud nako nakuha.. ang iya ra FORM ENTRY AKO NAKUHA>> I WILL ALSO POST IYA FORM ENTRY..
    mao ni ang GUI sa entry UPDATE..




    UPDATE PROGRAM FLOW


    • input the OR number and search in the ORHeader. if it is found and the status is 'OP', display all information about the OR. otherwise,display not found error.
    • Display the original items in the first flexgrid (above). Item unit price should be computed based on the total price of the item divided by the number of item.
    • Display the items to be update in the second flexgrid(below)
    • Customer Code (follow customer code restrictions in the entry)
    • date (follow date restrictions in the entry)
    • item quantity of the items display in the OR (quantity may be zero or above.)
    • prepared by (follow prepared by restrictions in the entry)
    • CLICK UPDATE
    • if all data are correct, update the ORHEADER and ORDETAIL. ORHEADER status is 'CL' if the quantity of all items in the OR is zero. otherwise, it is 'OP'
    • if some data are incorrect, do not continue saving rather issue an error message.
    • CLICK CLEAR
    • Erase all data values in the txtboxes, labels and flexgrid

  2. #2
    then mao ni ako code sa ako FORM ENTRY... i need your help to UPDATE. . . tnx.




    Option Explicit



    Dim dtm As Date
    Dim GrandTotal As Single
    Dim found As Boolean
    Dim day As Currency
    Dim r As Integer
    Dim k As Integer
    Dim total As Single
    Dim resp As Integer




    Private Sub cmdsave_Click()
    If checkFields = True Then
    MsgBox "pls fill up all fields", vbCritical

    Else

    'save ORHEADER
    rORH.AddNew
    rORH!ORHNum = txtOR.Text
    rORH!ORHDate = Format(Date, "mm/dd/yyyy")
    rORH!ORHCustCode = txtCustCode.Text
    rORH!ORHPrepBy = txtPrepBy.Text
    rORH!ORHGrandTotal = Format(GrandTotal, "0.00")
    rORH!ORHStatus = "OP"
    rORH.Update

    'save ORDetail
    For k = 1 To (r - 1)
    rORD.AddNew
    rORD!ORDNum = txtOR.Text
    rORD!ORDItemCode = Val(grd.TextMatrix(k, 1))
    rORD!ORDQty = Val(grd.TextMatrix(k, 3))
    rORD!ORDTotal = Format(total, "#,#0.00")
    rORD!ORDStatus = "OP"
    rORD.Update

    Next
    MsgBox "successfully save", vbInformation

    End If


    End Sub



    Private Sub CmdClear_Click()
    txtCustCode.Text = ""
    lblName.Caption = ""
    lblAddr.Caption = ""

    txtOR.Text = ""

    txtDate.Text = ""
    txtItem.Text = ""
    txtQty = ""
    txtPrepBy.Text = ""
    lblEmp.Caption = ""
    lblGrandTotal.Caption = ""



    End Sub

    Private Sub form_load()
    Call abredatabase
    Call SetAllTables
    grd.Rows = 2
    r = 1
    End Sub

    Private Sub mnuUpdate_Click()
    MsgBox "UnderConstruction", vbCritical
    End
    End Sub



    Private Sub txtCustCode_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then


    If checkCustomerFile(txtCustCode.Text) = True Then

    If rCust!custStatus = "AC" Then
    lblName.Caption = rCust!custName
    lblAddr.Caption = rCust!custAddr
    txtOR.SetFocus
    Else



    MsgBox " Customer Account No Longer Acitve", vbCritical
    txtCustCode.Text = ""
    lblName.Caption = ""
    lblAddr.Caption = ""
    End If
    Else

    MsgBox "Customer Code not found", vbCritical
    txtCustCode.Text = ""
    lblName.Caption = ""
    lblAddr.Caption = ""

    End If
    End If


    End Sub

    Private Sub txtDate_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
    txtDate.Text = Format(txtDate.Text, "mm/dd/yyyy")
    If txtDate.Text = "" Then
    MsgBox "Error: date field is empty", vbInformation
    txtDate.SetFocus
    ElseIf IsDate(txtDate.Text) = False Then
    MsgBox "Error", vbCritical
    ElseIf CDate(txtDate.Text) < Date Then
    MsgBox "date must be date today", vbInformation
    txtDate.Text = ""
    txtDate.SetFocus
    ElseIf CDate(txtDate.Text) > Date Then
    MsgBox "Fiscal year error!", vbInformation
    txtDate.Text = ""
    txtDate.SetFocus
    Else
    txtItem.SetFocus
    End If
    End If
    End Sub

    Private Sub txtItem_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
    found = False
    For k = 1 To (r - 1)
    If Trim(txtItem.Text) = grd.TextMatrix(r, 1) Then
    MsgBox "Item Code already exist", vbCritical

    found = True
    k = r
    End If
    Next
    If Not found Then
    If checkItem(txtItem.Text) = True Then
    If rItem!itemStatus = "AV" Then

    grd.TextMatrix(r, 1) = rItem!itemCode
    grd.TextMatrix(r, 2) = rItem!itemDesc
    grd.TextMatrix(r, 4) = rItem!itemUPrice
    txtQty.SetFocus

    Else
    MsgBox "Item is no longer available", vbCritical
    txtItem.Text = ""
    txtItem.SetFocus
    End If
    Else
    MsgBox "Item Code not found ", vbCritical
    txtItem.Text = ""
    txtItem.SetFocus
    End If
    End If
    End If
    End Sub

    Private Sub txtOR_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
    If checkORDetail(txtOR.Text) = True Then
    MsgBox "Already Use", vbCritical
    Else
    txtDate.SetFocus
    End If
    End If



    End Sub



    Private Sub txtPrepBy_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
    If checkEmployee(txtPrepBy.Text) = True Then
    If rEmp!empStatus = "AC" Then
    lblEmp.Caption = rEmp!empName


    Else
    lblEmp.Caption = rEmp!empName
    MsgBox " Employee is no Longer Active", vbCritical
    txtPrepBy.Text = ""
    lblEmp.Caption = ""
    End If
    Else
    MsgBox "Employee ID not Found", vbCritical
    txtPrepBy.Text = ""
    lblEmp.Caption = ""
    End If



    End If
    End Sub

    Private Sub txtQty_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then

    If txtQty.Text <= 0 Then
    MsgBox "Invalid number", vbCritical
    Else
    grd.TextMatrix(r, 3) = txtQty.Text
    total = Val(grd.TextMatrix(r, 3)) * Val(grd.TextMatrix(r, 4))
    grd.TextMatrix(r, 5) = Format(total, "0.00")

    grd.Rows = grd.Rows + 1
    r = r + 1

    resp = MsgBox("Add another one?", vbYesNo + vbQuestion)
    If resp = vbYes Then
    txtItem.Text = ""
    txtQty.Text = ""
    txtItem.SetFocus
    Else
    txtPrepBy.SetFocus
    End If
    GrandTotal = total + GrandTotal

    lblGrandTotal.Caption = Format(GrandTotal, "0.00")


    End If

    End If
    End Sub

    Public Function checkFields() As Boolean
    If txtCustCode.Text = "" Or txtOR.Text = "" Or txtDate.Text = "" Or txtItem.Text = "" Or txtQty.Text = "" Or txtPrepBy.Text = "" Then
    checkFields = True
    Else
    checkFields = False
    End If
    End Function







    kani nga code kay sa iya module....


    Public db As Database
    Public rCust As Recordset
    Public rORD As Recordset
    Public rItem As Recordset
    Public rEmp As Recordset
    Public rORH As Recordset
    Public Sub abredatabase()
    Set db = OpenDatabase("C:\Documents and Settings\computer\Desktop\Ferdie\finals VB\VBBBB.mdb")
    End Sub
    Public Sub SetAllTables()
    Set db = OpenDatabase("C:\Documents and Settings\computer\Desktop\Ferdie\finals VB\VBBBB.mdb")
    Set rORD = db.OpenRecordset("ORDETAIL")
    Set rCust = db.OpenRecordset("CUSTOMERFILE")
    Set rItem = db.OpenRecordset("ITEMFILE")
    Set rEmp = db.OpenRecordset("EMPLOYEEFILE")
    Set rORH = db.OpenRecordset("ORHEADER")
    End Sub

    Public Function checkItem(id As String) As Boolean
    rItem.Index = "itemCode"
    rItem.Seek "=", Trim(id)
    If rItem.NoMatch Then
    checkItem = False
    Else
    checkItem = True
    End If
    End Function
    Public Function checkORDetail(id As String) As Boolean
    rORD.Index = "ORDNum+ORDItem"
    rORD.Seek "=", Trim(id)
    If rORD.NoMatch Then
    checkORDetail = False
    Else
    checkORDetail = True
    End If
    End Function

    Public Function checkCustomerFile(id As String) As Boolean
    rCust.Index = "CustCode"
    rCust.Seek "=", Trim(id)
    If rCust.NoMatch Then
    checkCustomerFile = False
    Else
    checkCustomerFile = True
    End If
    End Function

    Public Function checkEmployee(id As String) As Boolean
    rEmp.Index = "Employee"
    rEmp.Seek "=", Trim(id)
    If rEmp.NoMatch Then
    checkEmployee = False
    Else
    checkEmployee = True
    End If
    End Function
    Public Function checkORHeader(id As String) As Boolean
    rORH.Index = "ORNum"
    rORH.Seek "=", Trim(id)
    If rORH.NoMatch Then
    checkORHeader = False
    Else
    checkORHeader = True
    End If
    End Function

  3. #3
    aw... bai ucnian ka sah? hmm... about sa update dali raman pd sa update... some module same ra ghpon imung gami2n pra sa update.. ehehe

  4. #4
    patay ni ni sanchez...

  5.    Advertisement

Similar Threads

 
  1. Replies: 23
    Last Post: 11-28-2012, 08:33 AM
  2. Need Help to Update or Flash Bios?
    By Apollo24 in forum Computer Hardware
    Replies: 0
    Last Post: 07-24-2012, 08:14 PM
  3. Help: Need Place To Stay In Or Near Cebu For 4 to 6 Hours
    By binarypill in forum Destinations
    Replies: 19
    Last Post: 10-16-2010, 05:14 PM
  4. need help to reduce delays in online games
    By m4a1 in forum Software & Games (Old)
    Replies: 4
    Last Post: 08-31-2009, 12:01 PM
  5. Replies: 5
    Last Post: 10-06-2006, 08:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top