sunset1215
Registered User.
- Local time
- Tomorrow, 05:39
- Joined
- Apr 7, 2011
- Messages
- 46
[Solved] Do While ... Loop help
hi all, i'm trying to add payment records when my clients' status is pending payment.
i came up with this code, but it is giving me an error at this line(highlighted in red), saying that i can't go to the specific record.
i have just realised that this happens because the code only copies the value of [pkXtID] of the first record in my fsubXt. how do i go about making it copy the corresponding ID for the rest of the records in my fsubXt?
code attached:
any help or advice is greatly appreciated.
hi all, i'm trying to add payment records when my clients' status is pending payment.
i came up with this code, but it is giving me an error at this line(highlighted in red), saying that i can't go to the specific record.
i have just realised that this happens because the code only copies the value of [pkXtID] of the first record in my fsubXt. how do i go about making it copy the corresponding ID for the rest of the records in my fsubXt?

code attached:
Code:
Private Sub cmdAddXtInc_Click()
Dim status
status = DLookup("strXtStatus", "tblXt", "[fkTrialID] = " & Me.pkTrialID)
DoCmd.OpenForm "fsubXtInc", acFormDS, , , acFormEdit, acHidden
Do While status = "Pending Payment"
[COLOR=red]DoCmd.GoToRecord acDataForm, "fsubXtInc", acNewRec[/COLOR]
Forms!fsubXtInc!fkXtID.Value = Forms!frmTrial!fsubXt!pkXtID.Value
Loop
DoCmd.Close acForm, "fsubXtInc", acSaveNo
End Sub
any help or advice is greatly appreciated.
Last edited: