|
简 发表于 2012-1-12 18:56 ![]()
我就是采用你所说的采用保存按钮的方法来实现了该效果。经过折腾,我好像找到一个原因,就是如果记录没有 ...
Private Sub cmdnext_Click()
On Error GoTo Err_cmdnext_Click
Dim ctr As Control
For Each ctr In Me.Controls
If TypeOf ctr Is TextBox Or TypeOf ctr Is ComboBox Then
If IsNull(ctr) Then
MsgBox ctr.ControlSource & "不能为空。"
ctr.SetFocus
Exit Sub
End If
If ctr.ControlSource = "卡号" Then
If Not IsNumeric(ctr) Or Len(ctr) <> 3 Then
MsgBox "请按照'***'格式输入卡号!"
ctr.SetFocus
Exit Sub
End If
End If
End If
Next
DoCmd.RunCommand acCmdSaveRecord
DoCmd.GoToRecord , , acNext
Me.cbogongchang.SetFocus
End_cmdnext_Click:
Exit Sub
Err_cmdnext_Click:
MsgBox Error
Resume End_cmdnext_Click
End Sub
用上面的代码置换你的代码试试。 |
|