当我在表格中插入表格中的值时,表格中的第一个值始终使用表格字段中列出的值进行更新。 我使用下面的代码: ++++++++++++++++++++++++++++++++++++++++++++++++
Private Sub Command114_Click()
If (Me.VehicleNumber = "" Or Me.vMake = "" Or Me.vModel = "") Then
MsgBox "Please fill required fields", vbInformation, "Information"
Else
CurrentDb.Execute "INSERT INTO [Vehicles]([VehicleNumber], [Make], [Model], [PurchasedMiles], [PurchasePrice], [PurchaseLocation], [PurchaseDate], [VehicleNotes])" & _
"VALUES ('" & Me.vVehicleNumber & "', '" & Me.vMake & "', '" & Me.vModel & "', '" & Me.vPurchasedMiles & "', '" & Me.vPurchasePrice & "', '" & Me.vPurchaseLocation & "', '" & Me.vPurchaseDate & "', '" & Me.vVehicleNotes & "')"
MsgBox "Vehicle Added", vbInformation, "Information"
End If
End Sub
请查看图片。
谢谢:D
答案 0 :(得分:1)
我认为每当您输入正在修改现有数据的数据时,您的表单都会受到限制。
如果要手动插入,请将表单的记录源值设置为空。
goto forms's property > Data section> Record Source > delete any entry there
或者让表格有界。并使用新的记录功能添加新记录。你甚至不需要手动插入功能。 Access会自动为您保存。