jemz -1 Master Poster

hello,

please help me on my updatebutton..can you please help me how to use the update statement...i want to save the changes that i made in my textfield...hoping for your positive responds...thanks in advance

Private Sub cmdupdate_Click()


sql = "Update *  from merchandise_table where mch_no = '" & m_mchno & "'"

mch_rs.Open sql, con, adOpenDynamic, adLockPessimistic

With mch_rs
             
             !mch_no = Trim(UCase(m_mchno))
             !mch_name = Trim(StrConv(txtname.Text, vbProperCase))
             !mch_umsr = Trim(LCase(txtumsr.Text))
             !mch_qtyh = Val(txtqtyh.Text)
             !mch_uprice = CDbl(txtuprice.Text)
             !mch_rstatus = "1"
             .Update
             .Close
   End With
   


MsgBox "Successfully updated", vbInformation, "Updated..."
clear1

Private Sub txtmchno_KeyDown(KeyCode As Integer, Shift As Integer)
 m_mchno = Trim(txtmchno.Text)
   If KeyCode = 13 Then
     If Len(Trim(txtmchno.Text)) <> 5 Then
       MsgBox "The field is empty or you have invalid input... please input 5 characters only..", vbInformation, "Invalid Input...Input again merchandise no."
       Call highlight(txtmchno)
       Exit Sub
       End If
       
     sql = "select * from merchandise_table where mch_no = '" & m_mchno & "'"
     Set mch_rs = con.Execute(sql)
     
     If mch_rs.BOF = True And mch_rs.EOF = True Then
       txtname.SetFocus
     Else
       
        Display
        End If
        mch_rs.Close
      End If
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.