Results 1 to 7 of 7
  1. #1
    Junior Member
    Join Date
    Feb 2010
    Gender
    Female
    Posts
    129

    Default unsaon ni pag trap? para dili mag redundant,,


    unsaon mani naku pag implement?
    example: if i have itemnumber 1, naa siya sulod rose,tulips....
    then if i try to input rose in itemnumber 1, it will trap me na naa nay rose and temnumber 1,

    Code:
    If TxtItemNu.Text = "" Then
               MsgBox "No Item Number entered.", vbOKOnly + vbCritical, "ERROR: Empty field/s. "
    '           TxtItemNu.SetFocus
               Exit Sub
           End If
           
    If TxtFlowerID.Text = "" Then
               MsgBox "No Flower ID entered.", vbOKOnly + vbCritical, "ERROR: Empty field/s. "
    '           TxtFlowerID.SetFocus
               Exit Sub
           End If
           
    If CboQuantity.Text = "" Then
               MsgBox "No Quantity entered.", vbOKOnly + vbCritical, "ERROR: Empty field/s. "
               CboQuantity.SetFocus
               Exit Sub
           End If
           
         On Error GoTo errSave
            Dim sqlstr As String
                sqlstr = "Insert Into STRUCTURE(STR_ITEMNO,STR_FLOWER,STR_QTY) values(" & TxtItemNu.Text & "," & TxtFlowerID.Text & "," & CboQuantity.Text & ")"
               
                     If CStr(TxtItemNu.Text) = CStr(TxtFlowerID.Text) Then
                    MsgBox ("The Item Number Can't be The Same with Flower ID")
                        Exit Sub
                    End If
                                
                Conn.BeginTrans
                Conn.Execute sqlstr
                Conn.CommitTrans
                
                MsgBox "STRUCTURE successfully saved!"
                
                CmdSave.Enabled = False
                CmdDelete.Enabled = False
                
                ClearText
                Unload Me
                Form1.Show
            
    ExitErr:
        Exit Sub
    errSave:
            Conn.RollbackTrans
            MsgBox "Error" & Err.Description, vbCritical
    Resume ExitErr
    unsaon mana naku? and unsa na code i need?
    ako lang gi apila ko save na code para sad naa mo guide sa flow sa ako code,,,

  2. #2
    ' try this daw bro,

    Code:
    ' ibutang ni sa module
    Public Function IsRecordExist(strSQL as string) As Boolean
    dim rs as new adodb.recordset
    
    set rs=new adodb.recordset
    rs.Open strSQL, conn,1,1
    
    If rs.EOF Then
       IsRecordExist= False
    Else
       IsRecordExist= True
    End If
    rs.close
    End Function
    
    ' kini ang paggamit,ibutang before sa On Error GoTo errSave
    If IsRecordExist("SELECT STR_ITEMNO,STR_FLOWER FROM STRUCTURE WHERE STR_ITEMNO=" & txtItemNu.Text & " AND STR_FLOWER=" & txtFlowerID.Text ) then
       msgbox "Put your message here..."
       Exit Sub
    End If
    '
    '

  3. #3
    ug sa dihang naggamit na si rhex tendo ug adodb... hehe...

  4. #4
    Junior Member
    Join Date
    Feb 2010
    Gender
    Female
    Posts
    129
    Quote Originally Posted by rhex_tendo View Post
    ' try this daw bro,

    Code:
    ' ibutang ni sa module
    Public Function IsRecordExist(strSQL as string) As Boolean
    dim rs as new adodb.recordset
    
    set rs=new adodb.recordset
    rs.Open strSQL, conn,1,1
    
    If rs.EOF Then
       IsRecordExist= False
    Else
       IsRecordExist= True
    End If
    rs.close
    End Function
    
    ' kini ang paggamit,ibutang before sa On Error GoTo errSave
    If IsRecordExist("SELECT STR_ITEMNO,STR_FLOWER FROM STRUCTURE WHERE STR_ITEMNO=" & txtItemNu.Text & " AND STR_FLOWER=" & txtFlowerID.Text ) then
       msgbox "Put your message here..."
       Exit Sub
    End If
    '
    '
    bro error diri dapita ay
    Code:
    rs.Open strSQL, conn,1,1

  5. #5
    ' unsay error bro

    ' ang conn, ang imo na connection sa database bro, i think familiar na ka ana...
    ' try to check if open imong connection....
    '

  6. #6
    Junior Member
    Join Date
    Feb 2010
    Gender
    Female
    Posts
    129
    Quote Originally Posted by rhex_tendo View Post
    ' unsay error bro

    ' ang conn, ang imo na connection sa database bro, i think familiar na ka ana...
    ' try to check if open imong connection....
    '
    datatype mismatch in criteria expression
    abg error bro, slamat kaayu bro

  7. #7
    Junior Member
    Join Date
    Feb 2010
    Gender
    Female
    Posts
    129
    bro solved na kai kuwang ra og ' and "

    thanks so much...

  8.    Advertisement

Similar Threads

 
  1. Singly links .. Unsaon ni pag suwat functions?
    By imjustap00rb0y in forum Programming
    Replies: 11
    Last Post: 02-26-2013, 12:51 PM
  2. 6 ka secreto para dili mag kabuwag
    By teomargulbin in forum Relationships (Old)
    Replies: 45
    Last Post: 08-11-2010, 12:09 PM
  3. Para ni sa mga minyo o mag asawa
    By victory in forum Family Matters
    Replies: 45
    Last Post: 01-28-2009, 06:38 PM
  4. Replies: 1
    Last Post: 04-28-2008, 10:17 AM
  5. unsaon man ni pag network? naglibog jud ko...
    By emc in forum Computer Hardware
    Replies: 31
    Last Post: 09-02-2005, 02:42 PM

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