Reputation: 99
I have a problem like this
If EditData = False Then
'Simpan data
If Grd_StatUjian.TextMatrix(Grd_StatUjian.RowSel, 2) > 30 Then
MsgBox "Sesi Tersebut Sudah Penuh... Silahkan Cari Sesi Lainnya...!", vbInformation, "Informasi"
Else
cn.Execute "INSERT INTO ujian_mhs VALUES ('" & 0 & "','" & TBox(0).Text & "','" & cb_sesi.Text & "','" & cb_hari.Text & "','" & TBox(3).Text & "','" & TBox(5).Text & "','" & cb_ujian.Text & "','" & frmBack.lbta.Caption & "')"
End If
Else
'Update data
cn.Execute "UPDATE ujian_mhs SET sesi_ujian='" & cb_sesi.Text & "',hari_ujian='" & cb_hari.Text & "',kd_instruktur='" & TBox(5).Text & "'" & _
"WHERE NPM='" & TBox(0).Text & "'"
End If
It shows "Type mismatch", especially in the part of this code :
If Grd_StatUjian.TextMatrix(Grd_StatUjian.RowSel, 2) > 30 Then
Can you tell me what's wrong? Thanks a lot
Upvotes: 0
Views: 137
Reputation: 3141
Grd_StatUjian.TextMatrix
returns the string and you are comparing integer with it. Refer the link.
Don't forget to add the check for string with non numeric data.
If CInt(Grd_StatUjian.TextMatrix(Grd_StatUjian.RowSel, 2)) > 30 Then
Upvotes: 1