|
- Private Sub Command10_Click()
- Dim ctl As Control
- Dim rs As New ADODB.Recordset
- For Each ctl In Me.Controls
- If TypeOf ctl Is TextBox Or TypeOf ctl Is ComboBox Then
- If IsNull(ctl) Then
- MsgBox ctl.Name & " 不可为空! "
- ctl.SetFocus
- Exit Sub
- End If
- End If
- Next
- With rs
- .Open "消费记录", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
- .AddNew
- .Fields("id") = Me.ID
- .Fields("日期") = Me.日期
- .Fields("二级类目id") = Me.二级类目ID
- .Fields("金额") = Me.金额
- .Fields("说明") = Me.说明
- .Update
- .Close
- End With
- MsgBox "记录已保存!"
- Set rs = Nothing
- End Sub
复制代码 |
|