Subforms

Little_Man22

Registered User.
Local time
Today, 16:34
Joined
Jun 23, 2001
Messages
118
I could use any available input or suggestions on how to accomplish the following:

I want to have a form that has a tab for a section called beneficiary. In this tab will be a few fields (name of beneficiary, share %, revocable, irrevocable, etc). I am looking to have these fields link with a subform (located on the bottom of the section) where this information will be stored. So when a user inputs a beneficiary the info will transfer from the field boxes and into this subform. The cursor will then go back to the beginning of the form and allow the user to enter another beneficiary whose infor will once again be saved in this subform. So in the end, when all of the beneficiary info has been entered, all of the beneficiary fields will be blank on the main form and I will be left with a subform that contains all of the entered information.

Any ideas?
 
The easiest way is to build your form with an Add button and keep creating records, using the main BeneficiaryID as the primary key, but if you are using this form mainly as a holding form for the information only, then you would have to create a recordset as follows:

Dim rstBeneficiary As Recordset

Set rstBeneficiary = dbs.OpenRecordset("tblBeneficiaries", DB_OPEN_DYNASET)
rstBeneficiary.Addnew
rstBeneficiary!Name = [Name]
rstBeneficiary!Share = [Share]
rstBeneficiary!Revocable = "Revocable"
rstBeneficiary!Tdate = [Date]
rstBeneficiary.Update
rstBeneficiary.Close

MsgBox ("Beneficiary entry added.")

End Sub

Replace the names as required
 
Is it possible to have information transfer out of fields and into other fields. I.E. when the user comes to the end of the main form can the form reset itself so that it is blank again and the entered information is now stored in a subform at the bottom of the page?

Ryan.
 
The code that I posted will take the information entered and transfer it to the specified table within the fields stated. I am assuming that your main form within your tab is using unbound text boxes. You would have to still place a command button, or use an After Update after filling in the first form to transfer.

But I would still question the logic, if you are already entering the information into the main form itself, could you not just have an Add New Record button, which would automatically save this information into the underlying tables and clear the fields ready for a new input, or as an alternative, you could use the forms properties and set its Cycle to "All Records", and by tabbing through the fields in proper order, it will create an automatic save and set you up a blank form ready for new input.
 
OK ... I think that it makes the most sense to go with your idea of using an add button
smile.gif
However, I am fairly new to Access and don't know what the code would look like to make the information in the fields transfer into the subform.

The forms name is frmClients the subform is named frmBeneficiary and I am using two tables called Beneficiary and Client. I tried the code that you had posted (replacing the names where applicable) yet it did not work.

Thanks again for your help.
 

Users who are viewing this thread

Back
Top Bottom