Page 6 of 6 FirstFirst ... 3456
Results 51 to 60 of 60

Thread: VB 6 need help

  1. #51

    Quote Originally Posted by rhex_tendo View Post
    ' la mn ko alam anang way pag.code nim...
    ' ing.ani ako way... hehehe

    Private Sub txtItemCode_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
    KeyAscii=0 ' para dili mu.beep
    If txtItemCode.Text = "" Then
    MsgBox "Field is empty", vbInformation
    Else
    If CheckIfExists("tbl_Item",txtItem.Text) Then
    MsgBox "Item Code does not exists", vbInformation
    Else
    txtQty.SetFocus
    End If
    End If
    End If
    End Sub

    Public Function CheckIfExists(ByVal tblName As String, ByVal strFilter as string) As Boolean
    rs.Open "SELECT fieldName FROM " & tblName & " WHERE fieldName='" & strFilter & "'", cn,3,1

    If rs.EOF Then
    CheckIfExists = False
    Else
    CheckIfExists = True
    End If
    rs.close
    End Function

    ' ambot sakto ba sab kaha ni... limot nko...
    '
    comment langko gamay

    sa kani nga code bah --> " If CheckIfExists("tbl_Item",txtItem.Text) Then " murag ang sakto ani kay
    If NOT CheckIfExists("tbl_Item",txtItem.Text) Then


    correct me if im wrong..



  2. #52
    ' yap, sakto bro...daan pa lagi ko dili ko sure if sakto ba...
    ' i made some changes. . . hehehe

    Private Sub txtItemCode_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
    KeyAscii=0 ' para dili mu.beep
    If txtItemCode.Text = "" Then
    MsgBox "Field is empty", vbInformation
    Else
    If Not CheckIfExists("SELECT fieldName FROM tblName WHERE fieldName='" & txtItem.Text & "'") Then
    MsgBox "Item Code does not exists", vbInformation
    Else
    txtQty.SetFocus
    End If
    End If
    End If
    End Sub

    Public Function CheckIfExists(strSQL as string) As Boolean
    rs.Open strSQL, cn,3,1

    If rs.EOF Then
    CheckIfExists = False
    Else
    CheckIfExists = True
    End If
    rs.close
    End Function

    '
    '

  3. #53
    any comments on this:
    Private Sub cmdUpdate_Click()
    Dim flag As Integer
    If txtCustCode.Text = "" Or lblCustName.Caption = "" Or lblCustAddr.Caption = "" _
    Or txtDate.Text = "" Or txtPO.Text = "" Or txtPrep.Text = "" Then
    MsgBox "Cannot save: Some fields are empty"
    ElseIf grdRow.Rows <= 2 Then
    MsgBox "Insufficient data", vbCritical
    ElseIf checkPO(txtPO.Text) = False Then
    MsgBox "PO number not found", vbCritical
    ElseIf DoesEmployeeExists(txtPrep.Text) = False Then
    MsgBox "Employee ID not found", vbCritical
    txtPrep.Text = ""
    ElseIf IsDateValid(txtDate) Then
    flag = 0
    Else
    flag = 1
    End If
    If flag = 0 Then
    For i = 1 To Row - 1
    query = "Select * from PODFile where PODNo = '" & txtPO.Text & "' AND PODItemCode = '" & grdRow.TextMatrix(i, 1) & "' "

    If DoesThisExists(rsPOD, query) Then
    With rsPOD
    .Edit
    !PODPrice = CCur(grdRow.TextMatrix(i, 4))
    !PODQty = !PODQty + Val(grdRow.TextMatrix(i, 3))
    !PODQtyBal = !PODQtyBal + Val(grdRow.TextMatrix(i, 3))
    !PODStat = "OP"
    .Update
    Else <<<<<<<<<<<<<<<<<<<<<<----- ngnao else without if mani?

    .AddNew
    !PODNo = txtPO.Text
    !PODItemCode = grdRow.TextMatrix(i, 1)
    !PODPrice = CCur(grdRow.TextMatrix(i, 4))
    !PODQty = Val(grdRow.TextMatrix(i, 3))
    !PODQtyBal = Val(grdRow.TextMatrix(i, 3))
    !PODStat = "OP"
    .Update
    End With
    End If
    Next i

    With rsPOH
    .Edit
    !POHDATE = CDate(txtDate.Text)
    !POHCustCode = Trim(txtCustCode.Text)
    !POHPrepBy = txtPrep.Text
    !POHStat = "OP"

    .Update
    End With
    MsgBox "Pob Order Update Saved Successfully", vbInformation
    Call Clear(frmupdate)
    Call ClearGrid(grdRow, Row)
    End If
    End Sub

  4. #54
    Quote Originally Posted by lestat1116 View Post
    For i = 1 To Row - 1
    totalAmt = totalAmt + Val(grdDisplay.TextMatrix(i, 5))
    Next i

    lblTotalAmt = format(val(totalAmt), "0.00")

    sakto ni?
    kay ako result nako kay zero
    unsay value nimo sa Row


    murag wala mana ni loop cguro kay ala value ang Row

    try debug mode aron makita nimo ang value ning sod taga for loop.. diha nmo makita


    if kahibaw ka mo sod og ma mark ana for debugging mas sayon mo trace

  5. #55
    ' bro ang With rsPOD ibutang igbaw sa If DoesThisExists(rsPOD, query) Then
    ' ug ang End With ibutang in between End If ug Next i
    '
    '

  6. #56
    asa dapit nako ibutang ang ang rs.close, db.closeor set rs = nothing? angay pa jud i.close ang db or rs to nothing?

    module

    public dbase as database
    public rsPOH as recordset
    public rsPOD as recordset

    Private Sub cmdUpdate_Click()
    Dim flag As Integer
    If txtCustCode.Text = "" Or lblCustName.Caption = "" Or lblCustAddr.Caption = "" _
    Or txtDate.Text = "" Or txtPO.Text = "" Or txtPrep.Text = "" Then
    MsgBox "Cannot save: Some fields are empty"
    ElseIf grdRow.Rows <= 2 Then
    MsgBox "Insufficient data", vbCritical
    ElseIf checkPO(txtPO.Text) = False Then
    MsgBox "PO number not found", vbCritical
    ElseIf DoesEmployeeExists(txtPrep.Text) = False Then
    MsgBox "Employee ID not found", vbCritical
    txtPrep.Text = ""
    ElseIf IsDateValid(txtDate) Then
    flag = 0
    Else
    flag = 1
    End If
    If flag = 0 Then
    For i = 1 To Row - 1
    query = "Select * from PODFile where PODNo = '" & txtPO.Text & "' AND PODItemCode = '" & grdRow.TextMatrix(i, 1) & "' "

    If DoesThisExists(rsPOD, query) Then
    With rsPOD
    .Edit
    !PODPrice = CCur(grdRow.TextMatrix(i, 4))
    !PODQty = !PODQty + Val(grdRow.TextMatrix(i, 3))
    !PODQtyBal = !PODQtyBal + Val(grdRow.TextMatrix(i, 3))
    !PODStat = "OP"
    .Update
    Else

    .AddNew
    !PODNo = txtPO.Text
    !PODItemCode = grdRow.TextMatrix(i, 1)
    !PODPrice = CCur(grdRow.TextMatrix(i, 4))
    !PODQty = Val(grdRow.TextMatrix(i, 3))
    !PODQtyBal = Val(grdRow.TextMatrix(i, 3))
    !PODStat = "OP"
    .Update
    End With
    End If
    Next i

    With rsPOH
    .Edit
    !POHDATE = CDate(txtDate.Text)
    !POHCustCode = Trim(txtCustCode.Text)
    !POHPrepBy = txtPrep.Text
    !POHStat = "OP"

    .Update
    End With
    MsgBox "Pob Order Update Saved Successfully", vbInformation
    Call Clear(frmupdate)
    Call ClearGrid(grdRow, Row)
    End If
    End Sub
    Last edited by lestat1116; 09-27-2010 at 03:41 PM.

  7. #57
    Quote Originally Posted by lestat1116 View Post
    asa dapit nako ibutang ang rs.close, db.close or set rs = nothing? angay pa jud i.close ang db or rs to nothing?
    Set rs=nothing ' para nko need ni bro kung human na ka gamit sa rs
    Cn.Close ' pwede ra dili i.close, error handler lang bro para i.check ang connection sa kada gamit nim
    ' kung close ang connection, den i.open ug utro. . .
    '
    ' obserbare lang bro, para ikaw jud ang makasabot kanus-a gamit ug ing.ana...
    '
    '

  8. #58
    paki sawsaw sad gale..

    unsa d.i ako sayop ani ai.. nganu ma error man siya if butangan nako og orh.update and rORD.update.. kung wala kay ma save siya pero wala makita sa ako database.. anu comments?



    Private Sub cmdsave_Click()
    If checkFields = True Then
    MsgBox "Cannot save because thier are still empty fields!hell yea!", vbCritical

    Else
    'save ORheader
    orh.AddNew
    orh!ORHNum = txtORNo.Text
    orh!ORHDate = Format(Date, "mm/dd/yyyy")
    orh!ORHCustCode = txtCode.Text
    orh!ORHPrepBy = txtpby.Text
    orh!ORHGrandTotal = GrandTotal
    orh!ORHStatus = "OP"
    orh.Update
    For k = 1 To (r - 1)
    'save ORdetail
    rORD.AddNew
    rORD!ORDNum = txtORNo.Text
    rORD!ORdItemCode = grd.TextMatrix(k, 1)
    rORD!ORDQty = grd.TextMatrix(k, 3)
    rORD!ORDtotal = Val(grd.TextMatrix(k, 3)) * Val(grd.TextMatrix(k, 4))
    rORD!ORDStatus = "OP"
    rORD.Update
    Next
    MsgBox "Customer file successfully save", vbInformation
    End If
    'Format(total, "#,#0.0")
    End Sub

  9. #59
    Quote Originally Posted by ferdz_willz View Post
    paki sawsaw sad gale..

    unsa d.i ako sayop ani ai.. nganu ma error man siya if butangan nako og orh.update and rORD.update.. kung wala kay ma save siya pero wala makita sa ako database.. anu comments?



    Private Sub cmdsave_Click()
    If checkFields = True Then
    MsgBox "Cannot save because thier are still empty fields!hell yea!", vbCritical

    Else
    'save ORheader
    orh.AddNew
    orh!ORHNum = txtORNo.Text
    orh!ORHDate = Format(Date, "mm/dd/yyyy")
    orh!ORHCustCode = txtCode.Text
    orh!ORHPrepBy = txtpby.Text
    orh!ORHGrandTotal = GrandTotal
    orh!ORHStatus = "OP"
    orh.Update
    For k = 1 To (r - 1)
    'save ORdetail
    rORD.AddNew
    rORD!ORDNum = txtORNo.Text
    rORD!ORdItemCode = grd.TextMatrix(k, 1)
    rORD!ORDQty = grd.TextMatrix(k, 3)
    rORD!ORDtotal = Val(grd.TextMatrix(k, 3)) * Val(grd.TextMatrix(k, 4))
    rORD!ORDStatus = "OP"
    rORD.Update
    Next
    MsgBox "Customer file successfully save", vbInformation
    End If
    'Format(total, "#,#0.0")
    End Sub

    unsa error ani bro? ibutang sab. .
    '

  10. #60
    Salamat sa inyo mga help ninyo! Thank you kaayo

  11.    Advertisement

Page 6 of 6 FirstFirst ... 3456

Similar Threads

 
  1. Need help in VB 6.0 and VB.Net?
    By rhex_tendo in forum Programming
    Replies: 10
    Last Post: 08-31-2010, 01:01 PM
  2. VBS need help
    By ManoyanX in forum Programming
    Replies: 2
    Last Post: 02-12-2010, 07:58 PM
  3. Replies: 1
    Last Post: 04-02-2009, 08:41 AM
  4. Who needs help with their vb/c# projects?
    By Cruzader in forum Programming
    Replies: 19
    Last Post: 02-24-2009, 02:44 PM
  5. Replies: 1
    Last Post: 07-30-2005, 01:35 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