Automatically Add Records to a Table

Elana

Registered User.
Local time
Today, 08:58
Joined
Apr 19, 2000
Messages
232
Hi -

My app is a claim administration app for an insurance brokerage.

I have a main form (frmClaimsEntry)where the user selects an insurance policy and a subform (frmPolicyUwrsSub) that displays the insurance company(ies)subscribing to that policy.

Here's what I need to do. For each ins. co. displayed in frmPolicyUwrsSub, the user also needs to select which person at the ins. company will be handling the claim, and in so doing, will be adding a record to tblUwrByClaim. Each record in tblUwrByClaim will contain my app's ClaimID (from the main form), the uwrID from frmPolicyUwrsSub, the UwrContactID from tblUwrContacts (combobox on the subform), and the claim contact's ref number.

I would like to automatically populate tblUwrByClaim with everything but the ContactID and ContactRefNo, since those are all contained in the main form and first subform's recordset.

I'm pretty sure I need to make use of the recordsetclone/recordcount property (which I've done)to count the records in the first subform.

My problem is getting on track with how to automatically populate the tblUwrByClaim. Can someone point me in the right direction? I just need a little shove and I can figure out the rest using my reference books.

Thanks!
 
Whoooeeee

I figured this out by myself!

Dim dbs As Database
Dim rst As Recordset
Dim rst1 As Recordset


Set dbs = CurrentDb()
Set rst = Forms!frmClaimsEntry!frmPolicyUwrsSubform.Form.RecordsetClone
Set rst1 = dbs.OpenRecordset("tblUwrByClaim")

Do Until rst.EOF
rst1.AddNew
rst1!ClaimID = Forms!frmClaimsEntry!ClaimID
rst1!SUwrID = rst!SUwrID
rst1.Update
rst.MoveNext

Loop
 

Users who are viewing this thread

Back
Top Bottom