我不会在表中插入数据,但并非所有字段都必须填写,某些字段是可选的。
CurrentDb.Execute "INSERT INTO tbl_Records_of_Violation(Serial_Number,Badge,Rank,Lastname,Firstname,Middlename,Qualifier,Gender,Birthdate,Date_Ent_Svc,Address,MotherUnit,Unit,Date_of_Commission,Reporting_Officer,Report_to_Supervisor,Approving_Authority,Punishment,Remarks,Violation1) VALUES ('" & Me.Serial_Number & "','" & Me.Badge & "','" & Me.Rank & "','" & Me.Lastname & "','" & Me.Firstname & "','" & Me.Middlename & "','" & Me.Qualifier & "','" & Me.Gender & "','" & Me.Birthdate & "','" & Me.Date_Ent_Svc & "','" & Me.Address & "','" & Me.MotherUnit & "','" & Me.Unit & "','" & Me.Date_of_Commission & "','" & Me.Reporting_Officer & "','" & Me.Report_to_Supervisor & "','" & Me.Approving_Authority & "','" & Me.Punishment & "','" & Me.Remarks & "'," & Me.Violation1 & ")"
MsgBox "Record has been updated", vbInformation, "Record Information"
我希望即使该字段之一为空也要保存在我的表中。
答案 0 :(得分:0)
表tbl_Records_of_Violation包含20条该命令插入的数据。
这20列中的每列都应定义为Nullable,
,并且每个屏幕值(Me.xxx)都必须具有有效的数据或null。