0

Private Sub btnedit_Click()

Dim a As Variant
Set conn = New ADODB.Connection
strConn = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=SPUM;Data Source=(LOCAL)"
conn.ConnectionString = strConn
conn.CursorLocation = adUseClient
conn.Open
'lblindexid.Caption = rs!Indexid

strsql = " Select * from ES_otherSchools where Indexid = '" & lblindexid.Caption & "' "
Set rs = conn.Execute(strsql)


strsql = " Update ES_OtherSchools set SchoolCode = '" & txtschoolcode.Text & _
"', SchoolName = '" & txtnameofschool.Text & "', Shortname = '" & txtshortname.Text & _
"', Address = '" & txtaddress.Text & _
"', Telephone = '" & txttelno.Text & "', Fax = '" & txtfax.Text & _
"', URL = '" & txturl.Text & "', Email = '" & txtemail.Text & _
"', InsClassCode = '" & cboschoolclass.Text & "' where Schoolcode = '" & lblschoolcode.Caption & "' "

With msflex
If txtschoolcode.Text = .TextMatrix(.Row, 0) And txtshortname.Text = .TextMatrix(.Row, 1) Then
MsgBox "School Code Must not the same to other...", vbExclamation, "Invalid Input"
Else
Set rs = conn.Execute(strsql)
End If
End With

MsgBox ("Record Edited.."), vbInformation, "System Message"
strsql = "Select * from ES_OtherSchools"
Set rs = conn.Execute(strsql)
'rs.Open strsql, conn, adOpenDynamic, adLockOptimistic
btnedit.Enabled = False
msflex.Rows = 1
While Not rs.EOF
msflex.AddItem rs!Schoolcode & vbTab & _
rs!SchoolName & vbTab & _
rs!ShortName & vbTab & _
rs!Address & vbTab & _
rs!Telephone & vbTab & _
rs!Fax & vbTab & _
rs!URL & vbTab & _
rs!Email & vbTab & _
rs!InsClassCode & vbTab
rs.MoveNext
Wend
Call Clear
conn.Close
End Sub

1
Contributor
2
Replies
3
Views
9 Years
Discussion Span
Last Post by agent7
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.