0
我有這樣的代碼在VBA:VBA訪問編譯:方法或數據成員未找到
Private Sub cmdAdd_Click()
'when we click on button Add there are two options
'1. for insert
'2. for update
If Me.Barcode & "" = "" Then
'this is for insert new
'add data to table
CurrentDb.Execute "INSERT INTO tab_barcodeki([date], [time], category, barcode) " & _
" VALUES(" & Me.Date & ",'" & Me.Time & "','" & _
Me.Category & "','" & Me.Barcode & "')"
Else
'otherwise (Tag of barcode store the id of liquid to be modified)
CurrentDb.Execute "UPDATE tab_barcodeki " & _
" SET [date]=" & Me.Date & _
", [time]='" & Me.Time & "'" & _
", category='" & Me.Category & "'" & _
", barcode='" & Me.Barcode & "'" & _
" WHERE barcode=" & Me.Barcode.Tag
End If
'clear form
cmdClear_Click
'refresh data in list on form
tab_barcodekisubform.Form.Requery
End Sub
我編譯時編譯有錯誤,方法或數據成員未找到。我已經檢查過表格列和文本框的名稱,文本框鏈接是相同的。 你有什麼想法的解決方案?
感謝
我沒有提到,但現在我有另一個編譯錯誤:「Invalid or unqualified reference」when I want Edit function like Me!Date = .Fields(「date」) –
@RóbertVizi - 你有字段名爲'date '?也許你可以嘗試將它重命名爲'date1'或'CreationDate',因爲AFAIK,'date'是保留字。 – miroxlav
是的字段名爲日期,但我不想重命名它,因爲它取決於許多查詢。但插入,刪除,更新功能工作正常,只是我得到編譯錯誤消息。所以謝謝 –