C
cw via AccessMonster.com
I'm using the following code to automatically create "X" records in my
database:
------------------------------------------------------------------------------
------------------------
Private Sub Command6_Click()
Dim dbCurr As DAO.Database
Dim CityID As Integer
Dim ColloCityID As Integer
Dim NodeID As Integer
Dim CalixTypeID As Integer
Dim SerTypID As Integer
Dim CWCPtypeID As Integer
Dim strModifiedBy As String
Dim intCount As Integer
Dim intStep As Integer
Dim strSQL As String
intCount = Me.HowMany
CityID = Me.txtCityCode
ColloCityID = Me.txtColloCode
NodeID = Me.txtCalixNode
CalixTypeID = Me.txtCalixType
SerTypID = Me.txtServType
CWCPtypeID = Me.txtCWCPtype
strModifiedBy = "ja"
Set dbCurr = CurrentDb()
For intStep = 1 To intCount
strSQL = "INSERT INTO tblCP(CityID, ColloCityID, " & _
"NodeID, CalixTypeID, SerTypID, CWCPtypeID, strModifiedBy) VALUES(" &
_
CityID & ", " & ColloCityID & ", " & _
NodeID & ", " & CalixTypeID & ", " & SerTypID & ", " & CWCPtypeID & ",
'" & strModifiedBy & "')"
dbCurr.Execute strSQL, dbFailOnError
Next intStep
End Sub
---------------------------------------------------------------------
This works fine!
I also need it to fill-in the field in my Table called VrzPair field, but do
it incrementally based a range of values.
On my Form I have added Unbound Text boxes called BegValue & EndValue.
How would I make the Code not only Create the records as before, but also
fill in each records VrzPair field with the Incremented value?
Thanks again for all your help,
cw
database:
------------------------------------------------------------------------------
------------------------
Private Sub Command6_Click()
Dim dbCurr As DAO.Database
Dim CityID As Integer
Dim ColloCityID As Integer
Dim NodeID As Integer
Dim CalixTypeID As Integer
Dim SerTypID As Integer
Dim CWCPtypeID As Integer
Dim strModifiedBy As String
Dim intCount As Integer
Dim intStep As Integer
Dim strSQL As String
intCount = Me.HowMany
CityID = Me.txtCityCode
ColloCityID = Me.txtColloCode
NodeID = Me.txtCalixNode
CalixTypeID = Me.txtCalixType
SerTypID = Me.txtServType
CWCPtypeID = Me.txtCWCPtype
strModifiedBy = "ja"
Set dbCurr = CurrentDb()
For intStep = 1 To intCount
strSQL = "INSERT INTO tblCP(CityID, ColloCityID, " & _
"NodeID, CalixTypeID, SerTypID, CWCPtypeID, strModifiedBy) VALUES(" &
_
CityID & ", " & ColloCityID & ", " & _
NodeID & ", " & CalixTypeID & ", " & SerTypID & ", " & CWCPtypeID & ",
'" & strModifiedBy & "')"
dbCurr.Execute strSQL, dbFailOnError
Next intStep
End Sub
---------------------------------------------------------------------
This works fine!
I also need it to fill-in the field in my Table called VrzPair field, but do
it incrementally based a range of values.
On my Form I have added Unbound Text boxes called BegValue & EndValue.
How would I make the Code not only Create the records as before, but also
fill in each records VrzPair field with the Incremented value?
Thanks again for all your help,
cw