access多数据录入

时间:2016-10-21 06:53:11
【文件属性】:

文件名称:access多数据录入

文件大小:304KB

文件格式:MDB

更新时间:2016-10-21 06:53:11

数据

ACCESS多条数据录入,可以方便用户Private Sub BtOK_Click() Dim strSQL As String If (Me.CbSize.Value <> "<全部尺寸>") Then strSQL = "INSERT INTO 服装表(服装名称,款式,尺寸) VALUES('" & Me.TxName.Value & "','" & Me.TxStyle.Value & "'," & Me.CbSize.Value & ");" DoCmd.SetWarnings False DoCmd.RunSQL strSQL DoCmd.SetWarnings True Else strSQL = "CREATE TABLE 服装临时表(服装名称 CHAR(50) PRIMARY KEY,款式 CHAR(50));" 'DoCmd.SetWarnings False DoCmd.RunSQL strSQL 'DoCmd.SetWarnings True strSQL = "INSERT INTO 服装临时表(服装名称,款式) VALUES('" & Me.TxName.Value & "','" & Me.TxStyle.Value & "');" 'DoCmd.SetWarnings False DoCmd.RunSQL strSQL 'DoCmd.SetWarnings True strSQL = "INSERT INTO 服装表(服装名称,款式,尺寸) SELECT 服装名称,款式,尺寸 FROM 服装临时表,尺寸表;" 'DoCmd.SetWarnings False DoCmd.RunSQL strSQL 'DoCmd.SetWarnings True strSQL = "DROP TABLE 服装临时表" 'DoCmd.SetWarnings False DoCmd.RunSQL strSQL 'DoCmd.SetWarnings True End If MsgBox "添加成功" End Sub


网友评论