"Robert" <(E-Mail Removed)> wrote in
news:093d01c3a7a1$265bceb0$(E-Mail Removed):
> Then find the record Item of tblItem which is equal
> to Forms!Sales!item.
>
> Once this record is found, then I want to update
> the InStock control where
>
> InStock = InStock - SaleQty
>
Well, you don't actually say what is wrong with the code you posted, but I
would do this whole thing in two lines:
' you will need to check the data types and make sure
' that there are quotes in all the right places
strSQL = "UPDATE tblItem " & vbCrLf & _
"SET InStock = InStock - " & Me!SaleQty.Value & vbCrLf & _
"WHERE Item = """ & Forsm!Sales![Item].Value & """;"
' I rarely use the ADO methods, so you'll have to check
' up on the parameters for this, but you should see
' roughly what is meant to happen.
CurrentProject.ActiveConnection.Execute strSQL, _
adoCommandText, adoDoesNotReturnRecords
Hope that helps
Tim F
|