By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,677 Members | 1,136 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,677 IT Pros & Developers. It's quick & easy.

Recordset Help

P: n/a
I am looking for help using recordset. I currenty have a form which
uses recordset.add to add records to a table. the form is designed to
add multiple records at once by auto incrementing. It stores
information about T1's so when one T1 is added it adds 24 records one
for each channel.
I now would like to be able to use recordset to find a specific T1 and
either modify the records or delete them. The code I use to add is
below as well as a sample record. In the sample record I may want to
change the value "Customer 1" to "Customer 2" or I may simply want to
delete the record.
Function AddT1Ports(lngStart As Long, lngEnd As Long, lngRR As String,
lngEquip As String, lngLoc As String, lngTrans As String, lngShelf As
String, lngSlotCard As Long, lngAssignment As String)
Dim rsPorts As DAO.Recordset
Dim lngCounter As Long

Set rsPorts = DBEngine(0)(0).OpenRecordset("tblT1", dbopentable)

For lngCounter = lngStart To lngEnd
With rsPorts
.AddNew
.Fields("Equipment") = lngEquip
.Fields("Location") = lngLoc
.Fields("RR") = lngRR
.Fields("Shelf") = lngShelf
.Fields("Slot") = lngSlotCard
.Fields("Channel") = lngCounter
.Fields("Assignment") = lngAssignment
.Fields("Transmission") = lngTrans
.Update
End With
Next lngCounter

rsPorts.Close
Set rsPorts = Nothing

End Function

ID/Equipment/Location/RR/Shelf/Slot/Channel/Transmission/Assignment
3/DSX/OAK/101.12/16/22/1/DS0/Customer 1
4/DSX/OAK/101.12/16/22/2/DS0/Customer 1
5/DSX/OAK/101.12/16/22/3/DS0/Customer 1
6/DSX/OAK/101.12/16/22/4/DS0/Customer 1
7/DSX/OAK/101.12/16/22/5/DS0/Customer 1
8/DSX/OAK/101.12/16/22/6/DS0/Customer 1
9/DSX/OAK/101.12/16/22/7/DS0/Customer 1
10/DSX/OAK/101.12/16/22/8/DS0/Customer 1
11/DSX/OAK/101.12/16/22/9/DS0/Customer 1
12/DSX/OAK/101.12/16/22/10/DS0/Customer 1
13/DSX/OAK/101.12/16/22/11/DS0/Customer 1
14/DSX/OAK/101.12/16/22/12/DS0/Customer 1
15/DSX/OAK/101.12/16/22/13/DS0/Customer 1
16/DSX/OAK/101.12/16/22/14/DS0/Customer 1
17/DSX/OAK/101.12/16/22/15/DS0/Customer 1
18/DSX/OAK/101.12/16/22/16/DS0/Customer 1
19/DSX/OAK/101.12/16/22/17/DS0/Customer 1
20/DSX/OAK/101.12/16/22/18/DS0/Customer 1
21/DSX/OAK/101.12/16/22/19/DS0/Customer 1
22/DSX/OAK/101.12/16/22/20/DS0/Customer 1
23/DSX/OAK/101.12/16/22/21/DS0/Customer 1
24/DSX/OAK/101.12/16/22/12/DS0/Customer 1
25/DSX/OAK/101.12/16/22/23/DS0/Customer 1
26/DSX/OAK/101.12/16/22/24/DS0/Customer 1

May 10 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Brian wrote:
I am looking for help using recordset. I currenty have a form which
uses recordset.add to add records to a table. the form is designed to
add multiple records at once by auto incrementing. It stores
information about T1's so when one T1 is added it adds 24 records one
for each channel.
I now would like to be able to use recordset to find a specific T1 and
either modify the records or delete them. The code I use to add is
below as well as a sample record. In the sample record I may want to
change the value "Customer 1" to "Customer 2" or I may simply want to
delete the record.
Function AddT1Ports(lngStart As Long, lngEnd As Long, lngRR As String,
lngEquip As String, lngLoc As String, lngTrans As String, lngShelf As
String, lngSlotCard As Long, lngAssignment As String)
Dim rsPorts As DAO.Recordset
Dim lngCounter As Long

Set rsPorts = DBEngine(0)(0).OpenRecordset("tblT1", dbopentable)

For lngCounter = lngStart To lngEnd
With rsPorts
.AddNew
.Fields("Equipment") = lngEquip
.Fields("Location") = lngLoc
.Fields("RR") = lngRR
.Fields("Shelf") = lngShelf
.Fields("Slot") = lngSlotCard
.Fields("Channel") = lngCounter
.Fields("Assignment") = lngAssignment
.Fields("Transmission") = lngTrans
.Update
End With
Next lngCounter

rsPorts.Close
Set rsPorts = Nothing

End Function

ID/Equipment/Location/RR/Shelf/Slot/Channel/Transmission/Assignment
3/DSX/OAK/101.12/16/22/1/DS0/Customer 1
4/DSX/OAK/101.12/16/22/2/DS0/Customer 1
5/DSX/OAK/101.12/16/22/3/DS0/Customer 1
6/DSX/OAK/101.12/16/22/4/DS0/Customer 1
7/DSX/OAK/101.12/16/22/5/DS0/Customer 1
8/DSX/OAK/101.12/16/22/6/DS0/Customer 1
9/DSX/OAK/101.12/16/22/7/DS0/Customer 1
10/DSX/OAK/101.12/16/22/8/DS0/Customer 1
11/DSX/OAK/101.12/16/22/9/DS0/Customer 1
12/DSX/OAK/101.12/16/22/10/DS0/Customer 1
13/DSX/OAK/101.12/16/22/11/DS0/Customer 1
14/DSX/OAK/101.12/16/22/12/DS0/Customer 1
15/DSX/OAK/101.12/16/22/13/DS0/Customer 1
16/DSX/OAK/101.12/16/22/14/DS0/Customer 1
17/DSX/OAK/101.12/16/22/15/DS0/Customer 1
18/DSX/OAK/101.12/16/22/16/DS0/Customer 1
19/DSX/OAK/101.12/16/22/17/DS0/Customer 1
20/DSX/OAK/101.12/16/22/18/DS0/Customer 1
21/DSX/OAK/101.12/16/22/19/DS0/Customer 1
22/DSX/OAK/101.12/16/22/20/DS0/Customer 1
23/DSX/OAK/101.12/16/22/21/DS0/Customer 1
24/DSX/OAK/101.12/16/22/12/DS0/Customer 1
25/DSX/OAK/101.12/16/22/23/DS0/Customer 1
26/DSX/OAK/101.12/16/22/24/DS0/Customer 1

Are you using a subform to display the T1 and subordinate channel
records? That's one method I'd use. If you want to do it via code,
check out Delete and Update queries and Docmd.Execute.
May 11 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.