I want to create a button that adds as many records to a table as you want. So I would have
- a text field where the user would input the number of records
- the code of the button having a for loop or while statement to add that many records as the user typed in
This is my code of a button that adds one record at a time. My VB is not good so could someone tell me how to put in a for loop or while statement that would do the trick? Thanks.
- a text field where the user would input the number of records
- the code of the button having a for loop or while statement to add that many records as the user typed in
This is my code of a button that adds one record at a time. My VB is not good so could someone tell me how to put in a for loop or while statement that would do the trick? Thanks.
Code:
Private Sub addbutton_Click()
If IsNull(Combo0) Then
MsgBox "Please select an Oil to add data (Top left corner)"
Else
Me![Property Subform].Form.AllowAdditions = True
Forms![Values Form]![Property Subform].SetFocus
DoCmd.GoToRecord , , acNewRec
Me![Property Subform].Form![TV_O_ID] = Combo88
Me![Property Subform].Form![T_TT_ID] = Combo86
'Weathering Info
Me![Property Subform].Form![WEATHERTYPE] = Text106
Me![Property Subform].Form![WEATHERUNIT] = Combo104
Me![Property Subform].Form![WEATHER%Num] = Combo102
Me![Property Subform].Form![WEATHER%Text] = Combo100
'Parameter Info
Me![Property Subform].Form![PARAMTYPE] = Combo114
Me![Property Subform].Form![PARAMUNIT] = Combo120
Me![Property Subform].Form![PARAMVALNum] = Combo112
Me![Property Subform].Form![PARAMVALText] = Combo110
Me![Property Subform].Form.AllowAdditions = False
End If
Me![Property Subform].Requery
End Sub