I am working on a employee DB in which there is a training form. I have over 2000 employees who need trainings from time to time. I need to create batches of predetermined number (i.e. 50) of employees in that form. Also, I need to create them for each new training. So trainings are linked to TrainingID. I have created a for loop statement just as the following:
Dim StartC As Integer
Dim EndC As Integer
Set StartC = Nz(DMax("BatchNo", "T25TrnBatch", "T25TrnBatch.TrnID= " & Forms!F13NewTraining!TrnId), 0) + 1
Set EndC = Me.TBatchtxt
StrSQL = "INSERT INTO T25TrnBatch(TrnID,BatchNo) VALUES((Forms!F13NewTraining!TrnId),StartC);"
For BCounter = StartC To EndC
DoCmd.SetWarnings False
DoCmd.RunSQL StrSQL
DoCmd.SetWarnings True
Next BCounter
(Note: TBatchtxt is the total batches need to be created)
But when I run it a pop up appears saying StartC.
Also I want the result to like the following:
BatchNo TrnID
1 101
2 101
3 101
Please HELP. Thanks.