Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding more than one record to a table 1

Status
Not open for further replies.

Sydney1

Technical User
Jul 14, 2004
156
US
Hi,

I'm trying to add more than one record at a time to a table based upon the Case selected so far I have:
Code:
 Select Case cboLitType

       Case "bka"
        Set MyDB = CurrentDb
        Set MyTable = MyDB.OpenRecordset("tblLoanSteps")
        MyTable.AddNew: MyTable("litigationID") = Forms!frmLitigationEntry!txtLitigationID
        MyTable("ScheduleDate") = Date: MyTable("Steps") = "1"
        MyTable.Update
End Select
Which adds one record. How would I go about adding more than one record with different values for the scheduledate and step fields for each Case selected.

Thanks so much for your help.

Sydney
 
Something like this ?
Set MyDB = CurrentDb
Set MyTable = MyDB.OpenRecordset("tblLoanSteps")
MyTable.AddNew
MyTable("litigationID") = Forms!frmLitigationEntry!txtLitigationID
Select Case cboLitType
Case "bka"
MyTable("ScheduleDate") = Date: MyTable("Steps") = "1"
Case "xyz"
MyTable("ScheduleDate") = Date + 15: MyTable("Steps") = "2"
End Select
MyTable.Update

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hi,

Thanks for the reply,

I'd like to add more than one record for each individual Case. Say 5 records for Case "BKA" and 4 records for Case "TBA"

Thanks for your help

Sydney.
 
And what is the problem ?
In each case block you can code any .AddNew ... .Update you want.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hi,

You're right. I just had a bit of code off and didn't think it would work more than once per case.

Thanks for the help, I really appreciate it. Have a great day.

Sydney
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top