Some of the code may help - access
文章來源: 無戒2011-10-22 21:21:51
If you have a form Name "invAHLList". Click a "InvoiceIDList" on the form, you can update the value of a field in the table "invHead" and using where to sort a record line has the same invoiceID with the one you select in the "invoiceIDList".Here is the code:

CurrentDb.Execute "Update invHead SET InvAcctRcvbCheck = -1" _& " WHERE [invoiceID] =" & Forms![invAHTList]![invoiceIDList]

NZ(Expression, valueWhenIs Null) is very useful. The following code returns the value and 'Null" when it is null:

Dim rate As String
rate = Nz(DLookup("invExRate", "invAHTqry", "[invoiceID]=" & Me.invoiceIDList), "Null")
MsgBox ("rate=     " & rate)