|
Private Sub Command5_Click()
Dim jitaixinghao As String '声明一个存放“机台型号”的数组
Dim SQL As String '声明一个SQL查询变量
jitaixinghao = Me.Text3 '给机台型号表变量赋值
Dim datinput As String '声明一个日期变量
Dim jitaibianhao As String '声明一个机台编号变量
datinput = InputBox("请输入领料日期") '给日期变量赋值,用Inputbox对话框
jitaibianhao = InputBox("请输入机台编号") '给机台编号变量赋值,用inputbox对话框
If datinput = "" Then '如果InPUTBOX为空值是关闭窗口
DoCmd.Close acForm, Me.Name
Exit Sub
End If
If jitaibianhao = "" Then
DoCmd.Close acForm, Me.Name
Exit Sub
End If
If MsgBox("是否确定要机台数据?", vbYesNo, "警告") = vbNo Then Exit Sub
SQL = "INSERT INTO 出库明细 ( 件号, 件名规格,出库数量,出库日期,备注) " _
& "SELECT 件号,件名规格,出库数量,#" & datinput & "#,'" & jitaibianhao & "' FROM " & jitaixinghao '#"&datinput&"#,为日期格式,'" & jitaibianhao & "'为文本格式。注意单引号
CurrentDb.Execute SQL '
MsgBox "添加完毕.", vbInformation
Me.出库明细子窗体3.Requery
Me.Text3 = Null
End Sub |
|