I am trying to get a user to be able to record a Cheque Number and then on a form key in the associated claim number and $ amounts associated with it.
I then want to run a procedure to go through each record on the form, find the associated claim number in the table claims and update the amount paid with the $ amount.
I tried to write the following code but it doesn't seem to be going through the records on the form like I had hoped.
Code:
Private Sub Command6_Click()
Dim CQNum As String
Dim WoNum As Integer
Dim Amount_Paid As Currency
CQNum = InputBox("Please enter the Cheque Number you wish to Process.", "Cheque Number")
If StrPtr(CQNum) = 0 Then
Exit Sub
ElseIf CQNum = "" Then
MsgBox "You did not enter a Cheque Number"
Exit Sub
End If
DoCmd.OpenTable "Cheque", acViewNormal, acAdd
Dim n As Recordset
Dim Strsql As String
Dim db As Database
Set db = CurrentDb
Strsql = "Update Claims SET Claims.Amount_Paid = " & Forms!Cheque.Amount & " AND set Claims.chq_number = " & CQNum & " WHERE claims.Claim_Number = " & Forms!Cheque.Claim_Number & ""
Do Until Forms!Cheque.EOF
CurrentProject.Connection.Execute (Strsql)
Loop
End Sub