C
cw via AccessMonster.com
I'm sorry to ask this "often asked question" again, but after 2 days of
reading thru posts I'm still stuck.
I have a small Form with 4 fields on it and a Command Button to "ADD RECORDS
to DATABASE":
(These are the only "Required" fields.)
--------------------------------------------------
txtCityCode (value is : 3)
txtColloCode (value is : 3)
txtCalixNode (value is : 4)
txtCalixType (value is : 1)
cmdAdd
How do I take the code below (thanks Danny Lesandrini) & insert 24 identical
records into my tblCP?
--------------------------------------------------
Private Sub CmdAdd_Click()
Dim txtCityCode As Integer
Dim txtColloCode As Integer
Dim txtCalixNode As Integer
Dim txtCalixType As Integer
Dim intCount As Integer
Dim intStep As Integer
Dim strSQL As String
intCount = 24
DoCmd.SetWarnings False
For intStep = 0 To intCount
strSQL = "INSERT INTO tblCP(CityCode, ColloCode,CalixNode, CalixType)
VAUES( val_1, val_2,
val_3, val_4)
DoCmd.RunSQL strSQL
Next
DoCmd.SetWarnings True
End Sub
----------------------------------------------
I'm still learning about strSql & INSERTS & don't quite understand how to
populate 24 records automatically with data from my Form?
Thanks for your help,
cw
reading thru posts I'm still stuck.
I have a small Form with 4 fields on it and a Command Button to "ADD RECORDS
to DATABASE":
(These are the only "Required" fields.)
--------------------------------------------------
txtCityCode (value is : 3)
txtColloCode (value is : 3)
txtCalixNode (value is : 4)
txtCalixType (value is : 1)
cmdAdd
How do I take the code below (thanks Danny Lesandrini) & insert 24 identical
records into my tblCP?
--------------------------------------------------
Private Sub CmdAdd_Click()
Dim txtCityCode As Integer
Dim txtColloCode As Integer
Dim txtCalixNode As Integer
Dim txtCalixType As Integer
Dim intCount As Integer
Dim intStep As Integer
Dim strSQL As String
intCount = 24
DoCmd.SetWarnings False
For intStep = 0 To intCount
strSQL = "INSERT INTO tblCP(CityCode, ColloCode,CalixNode, CalixType)
VAUES( val_1, val_2,
val_3, val_4)
DoCmd.RunSQL strSQL
Next
DoCmd.SetWarnings True
End Sub
----------------------------------------------
I'm still learning about strSql & INSERTS & don't quite understand how to
populate 24 records automatically with data from my Form?
Thanks for your help,
cw