我得到錯誤幾個參數。預計1.此VBA代碼,我不知道如何正確進入它...訪問VBA - 哪裏條款
Dim rs_invoice As DAO.Recordset
Set rs_invoice = CurrentDb.OpenRecordset("SELECT * FROM order_tbl WHERE invoice_no Is Null AND company_name='" _
& Me.cmb_start_company.Column(1) & "' AND shiped=" & "True")
If Not (rs_invoice.EOF And rs_invoice.BOF) Then
rs_invoice.MoveFirst
Do Until rs_invoice.EOF = True
rs_invoice.Edit
rs_invoice!invoice_no = invoice_number
rs_invoice.Update
rs_invoice.MoveNext
Loop
Else
'No records
End If
'Finish
rs_invoice.Close 'Close the recordset
Set rs_invoice = Nothing 'Clean up
感謝
未能進行你用'UPDATE order_tbl SET invoice_no =「&invoice_number&」WHERE invoice_no是Null AND company_name ='「&Me.cmb_start_company.Column(1)&」'AND shiped = True'行來做同樣的事情。 ?儘管我主張使用SQL參數而不是字符串連接。 –
謝謝,但我真的不知道如何使用此代碼你可以發佈樣品嗎?謝謝 – Pecurka
我對VBA不熟悉,但它看起來像[在ADO.NET中使用Command.Prepare的VBA相當於什麼](http://stackoverflow.com/a/1746897/1115360)可以幫助您。 –