給TAN--查詢太過複雜(編號:9083)

在您的範例中,我還是沒有看到您的程式和那一個元件(如TextBox)作繫結,所以您在程式中所作的addnew與update動作是沒有意義的!
因為您根本就沒有[指定任何一個Fieldsh的值]!!
以下是比較完整的程式碼
Option Explicit
Dim bk As Variant
-----------------------------
Private Sub Command5_Click()
Adodc1.Recordset.AddNew
Text1.SetFocus
Command6.Enabled = True
Command5.Enabled = False
End Sub

Private Sub Command6_Click()
Adodc1.Recordset.Update
Command6.Enabled = False
Command5.Enabled = True

End Sub
Private Sub Command7_Click()
公共意外P.Show
End Sub

Private Sub Command8_Click()
bk = Adodc1.Recordset.Bookmark
Command6.Enabled = False
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command8.Enabled = True
Text2.SetFocus
End Sub

Private Sub Command9_Click()
If MsgBox("您確定要刪除這筆資料嗎?", vbYesNo, "刪除資料") = vbYes Then
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
End If
End Sub
Private Sub Command10_Click()
Command5.Caption = "新增"
Command6.Enabled = False
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Command6.Enabled = False
Command8.Enabled = False
Command9.Enabled = False
End Sub

Private Sub Command11_Click()
Adodc1.Recordset.Update
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Command6.Enabled = False
Command8.Enabled = False


End Sub

Private Sub Command12_Click()
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
Command8.Enabled = True
Command9.Enabled = True
Command10.Enabled = True
Command11.Enabled = True

End Sub

Private Sub Text11_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text11.Text = Val(Text10.Text) * 4

End Sub
Private Sub Text13_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text13.Text = Val(Text12.Text) * 5

End Sub
Private Sub Text15_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text15.Text = Val(Text3.Text) + Val(Text5.Text) + Val(Text7.Text) + Val(Text9.Text) + Val(Text11.Text) + Val(Text13.Text)
End Sub
Private Sub Text17_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text17.Text = Val(Text16.Text) * 1
End Sub
Private Sub Text19_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text19.Text = Val(Text18.Text) * 2
End Sub
Private Sub Text21_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text21.Text = Val(Text20.Text) * 3
End Sub
Private Sub Text23_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text23.Text = Val(Text22.Text) * 3
End Sub
Private Sub Text25_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text25.Text = Val(Text24.Text) * 4
End Sub
Private Sub Text27_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text27.Text = Val(Text26.Text) * 5
End Sub
Private Sub Text29_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text29.Text = Val(Text17.Text) + Val(Text19.Text) + Val(Text21.Text) + Val(Text23.Text) + Val(Text25.Text) + Val(Text27.Text)
End Sub

Private Sub Text3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text3.Text = Val(Text2.Text) * 1

End Sub

Private Sub Text5_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text5.Text = Val(Text4.Text) * 2
End Sub

Private Sub Text7_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text7.Text = Val(Text6.Text) * 3
End Sub
Private Sub Text9_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text9.Text = Val(Text8.Text) * 3
End Sub