简体   繁体   English

找不到代码有什么问题

[英]Can't find what is wrong with the code

I Have this code, and I can't figure out what is wrong with it. 我有这段代码,我无法弄清楚这是怎么回事。 It does not return any error but field Date_Returned is not getting updated. 它没有返回任何错误,但是字段Date_Returned没有得到更新。 Please help. 请帮忙。

Private Sub txtbxret_Click()
Dim query As String
query = "UPDATE Rent SET Date_Returned = '" & Date & "' WHERE Date_Rent = " & txtrented.Value & " AND Customer_ID = " & txtbxcustID.Value & " AND Movie_ID = " & txtbxmovID.Value
DoCmd.RunSQL (query)


End Sub

I've double and triple checked all the field names and thay are ok by the way... 我已经一遍又一遍地检查了所有字段名称,顺便说一句还可以...

您必须在SQL中使用正确的日期值字符串表达式格式:

query = "UPDATE Rent SET Date_Returned = Date() WHERE Date_Rent = #" & Format(txtrented.Value, "yyyy\/mm\/dd") & "# AND Customer_ID = " & txtbxcustID.Value & " AND Movie_ID = " & txtbxmovID.Value

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM