Here is what I have for the code keep getting error on
Code:
'declare variables and assign address to object variables Dim strId As String, strPayment As String, curPayment As Currency Dim cnnTrip As adodb.Connection, rstPays As adodb.Recordset Set cnnTrip = Application.CurrentProject.Connection Set rstPays = New adodb.Recordset 'open the recordset rstPays.Open Source:="payments", ActiveConnection:=cnnTrip, _ CursorType:=adOpenForwardOnly, LockType:=adLockPessimistic 'enter student ID and amount paid, then convert amount paid to a number strId = InputBox(prompt:="Enter ID:", title:="Student ID") strPayment = InputBox(prompt:="Enter payment:", title:="Payment", Default:=0) curPayment = Val(strPayment) 'search for ID in ID field, then update the record's Paid and Updated fields rstPays.Find criteria:="id = '" & strId & "'" 'calculate total amount paid rstPays.Fields("paid").Value = rstPays.Fields("paid").Value - strPayment 'assign current date rstPays.Fields("updated").Value = Date 'save changes to record rstPays.Update 'close the recordset rstPays.Close Set rstPays = Nothing 'disassociate object variable from object
Comment