1
我想更新serial.Issuedate從窗體中獲取,但它給出的語法錯誤。 請幫我解決這個錯誤。 我的代碼如下:日期不通過vba中的sql代碼更新
Private Sub Command30_Click()
Set serialrs = CurrentDb.OpenRecordset("serial")
Dim Idate As Date
Dim Itodo As String
Idate = Me.IssuedDate.Value
Itodo = Me.IssuedToDO.Value
Dim issueqry As String
issueqry = "UPDATE serial " _
& " set serial.IssueToDO = '" & Itodo & "'" _
& " serial.issuedate = (#" & Format(Idate, "mm\/dd\/yyyy") & "#)" _
& " WHERE (((serial.id) Between 1 And 10)) "
DoCmd.RunSQL issueqry
MsgBox ("Issued Done")
End Sub
我對VBA不夠了解,但'Format'函數可能不需要'\ /'。你可能會寫'Format(Idate,「mm/dd/yyyy」)'' – zedfoxus