' 新增 刪除 修改 按鍵
Private Sub TOOL_BUTTOM_Click(Index As Integer)
On Error GoTo aaa
Dim I As Integer
Dim A As Integer ' 計算單一筆記錄 有多少欄位
Dim FieldSize As Integer
Select Case Index
Case Is = 0 '新增
With RS
.AddNew
A = .Fields.Count
For I = 0 To (A - 1)
Select Case .Fields(I).Type
Case Is = adVarWChar '202 字串
FieldSize = .Fields.Item(I).DefinedSize
.Fields(I).Value = Space(FieldSize)
Case Is = adDouble ' 5 數字
.Fields(I).Value = 0
Case Is = adBoolean ' 11 邏輯
.Fields(I).Value = 0 'false
Case Is = adDate ' 7 日期/時間
.Fields(I).Value = "00:00:00"
Case Else
MsgBox ("型態補捉失敗!!")
End Select
Next
.Update
End With
Case Is = 1 '刪除
With RS '
.Delete adAffectCurrent
End With
RS.Update
End Select
Exit Sub
aaa:
If Err.Number = -2147467259 Then
MsgBox (Err.Description & "::" & Err.Source)
End I