I assume something is wrong with my second Where condition in the Select Statement. It works when I run it with only the first Where condition.
Can someone help me with this, please?
Can someone help me with this, please?
Code:
Private Sub Price_AfterUpdate()
On Error GoTo ErrorHandler
If Me.CboBuyer > 0 Then
Dim CurrentPrice As Currency
CurrentPrice = Forms!frmpuppybuyerlist.Form!frmPuppyBuyerlistsubf.Form!Price
Dim CurrentInvoiceID As Long
CurrentInvoiceID = Forms!frmpuppybuyerlist.Form!frmPuppyBuyerlistsubf.Form!frmInvoice!InvoiceID
Dim SQL As String
SQL = "SELECT [InvoiceID], [Description], [Amount] from [tblInvoiceDetails] WHERE InvoiceID=" & CurrentInvoiceID And [Description] Like "Puppy"
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset(SQL)
With rs
If Not .BOF And Not .EOF Then
.MoveLast
.MoveFirst
If .Updatable Then
.Edit
![Amount] = CurrentPrice
.Update
End If
End If
.Close
End With
Me.Requery
Exitsub:
Set rs = Nothing
Exit Sub
End If
ErrorHandler:
Resume Exitsub
End Sub