参数太少,预计4;

时间:2016-02-21 07:21:36

标签: access-vba

Dim query As String
query = "insert into tbl_passenger(passenger_name,age,gender_id,address,phone_no,plane_no,seat_no,destination_id,time_id,price_id)values('" & _
Me.txtpassengername.Value & "'," & Me.txtage.Value & "," & Me.cmbgender.Column(1) & ",'" & Me.txtaddress.Value & "', " & Me.txtphone.Value & "," & _
Me.cmbplane.Column(1) & "," & Me.cmbseat.Column(1) & "," & Me.cmbdestination.Column(1) & "," & Me.cmbtime.Column(1) & "," & _
Me.cmbprice.Column(1) & ")"

CurrentDb.Execute (query)
MsgBox ("Data Inserted")

这是什么问题?我得到的错误是

  

参数太少,预计4;

1 个答案:

答案 0 :(得分:1)

插入调试行:

Debug.Print query
CurrentDb.Execute (query)
MsgBox ("Data Inserted")

研究你所看到的,你就会知道。或者在这里发布输出。