|
代码如下
Private Sub Command1_Click()
a1 = Trim(Me.text1)
a2 = Trim(Me.Text2)
a3 = Trim(Me.Text3)
a4 = Trim(Me.Text4)
a5 = Trim(Me.Text5)
a6 = Trim(Me.Text6)
a7 = Trim(Me.Text7)
Dim r As QueryDef
Dim s As String
If MsgBox("Do you want to add a new record?", vbOKCancel) = vbOK Then
Set r = CurrentDb.QueryDefs("add staff information")
s = "insert into [Staff Information]([Staff ID],[Name],[Sex],[E-mail],[Phone],[Password],[Skpye]) values(a1,a2,a3,a4,a5,a6,a7)"
r.SQL = s
r.Execute
MsgBox "Done"
End If
End Sub |
|