'保存按钮单击事件
Private Sub command4_Click()
On Error Resume Next
'保存数据,
If Text1(0).Text = "" Then
MsgBox "工号不能为空!"
Text1(0).SetFocus
Exit Sub
End If
If txtbumen.Text > 99 Then MsgBox "分数不可以大于99哦"
txtbumen.SetFocus
If txtbumen.Text < 78 Then MsgBox "分数不可以小于78哦"
txtbumen.SetFocus
If txtbumen.Text = "" Then MsgBox "请输入分数!"
txtbumen.SetFocus
'调用Recordset对象Update方法保存数据
rs.Update
rs.Fields("打分") = txtbumen.Text
End Sub一个保存按钮的代码,这里有两个问题:
1.我点保存后,为什么没有添加到数据库??
2.现在 txtbumen 里什么都不输入或者输入不满足条件,三条信息会各出现一次,怎么修改才可以只出现符合条件的提示??
新人新手,没有多少分数,还请各位大虾帮忙,谢谢~~~
Private Sub command4_Click()
On Error Resume Next
'保存数据,
If Text1(0).Text = "" Then
MsgBox "工号不能为空!"
Text1(0).SetFocus
Exit Sub
End If
If txtbumen.Text > 99 Then MsgBox "分数不可以大于99哦"
txtbumen.SetFocus
If txtbumen.Text < 78 Then MsgBox "分数不可以小于78哦"
txtbumen.SetFocus
If txtbumen.Text = "" Then MsgBox "请输入分数!"
txtbumen.SetFocus
'调用Recordset对象Update方法保存数据
rs.Update
rs.Fields("打分") = txtbumen.Text
End Sub一个保存按钮的代码,这里有两个问题:
1.我点保存后,为什么没有添加到数据库??
2.现在 txtbumen 里什么都不输入或者输入不满足条件,三条信息会各出现一次,怎么修改才可以只出现符合条件的提示??
新人新手,没有多少分数,还请各位大虾帮忙,谢谢~~~
Private Sub command4_Click()
On Error Resume Next
'保存数据,
If Text1(0).Text = "" Then
MsgBox "工号不能为空!"
Text1(0).SetFocus
Exit Sub
End If
if not isnumeric(txtbumen.text) then
msgbox "请输入数值型数据!",48,"提示"
txtbumen.setfocus
exit sub
end if
If txtbumen.Text > 99 Then MsgBox "分数不可以大于99哦"
txtbumen.SetFocus
exit sub
end if
If txtbumen.Text < 78 Then MsgBox "分数不可以小于78哦"
txtbumen.SetFocus
exit sub
end if
If txtbumen.Text = "" Then MsgBox "请输入分数!"
txtbumen.SetFocus
exit sub
end if
'调用Recordset对象Update方法保存数据
rs.addnew
rs.Fields("打分") = txtbumen.Text
rs.UpdateEnd Sub
rs.Fields("打分") = txtbumen.Text
调换位置才好呀
Private Sub command4_Click()
On Error Resume Next
'保存数据,
If Text1(0).Text = "" Then
MsgBox "工号不能为空!"
Text1(0).SetFocus
Exit Sub
End If
if not isnumeric(txtbumen.text) then
msgbox "请输入数值型数据!",48,"提示"
txtbumen.setfocus
exit sub
end if
If txtbumen.Text > 99 Then MsgBox "分数不可以大于99哦"
txtbumen.SetFocus
exit sub
end if '-->编译错误:end if没有 块if
If txtbumen.Text < 78 Then MsgBox "分数不可以小于78哦"
txtbumen.SetFocus
exit sub
end if
If txtbumen.Text = "" Then MsgBox "请输入分数!"
txtbumen.SetFocus
exit sub
end if
'调用Recordset对象Update方法保存数据
rs.addnew
rs.Fields("打分") = txtbumen.Text
rs.UpdateEnd Sub