PDA

View Full Version : Subform question



swoozie
06-16-2006, 08:41 AM
Access 2003,

I have a form. The parent form has specific data on it that is required by all other forms. Id number, User Name, Type (for instance) If user is trying to create a new record, the parent form generated a new ID number during the onload event and placed in the main table.

The issue I am having is getting the values from the parent form to pass into the corresponding fields of the subforms.

I have tried
Forms!frmSubform!txtID.value = ID 'a variable assigned

In the Onload events, OnEnter events and nothing happends other than an issue around not being able to locate the form.

:bug: do you have any suggestions?

OBP
06-16-2006, 08:59 AM
It would help if you posted a zipped copy of the database so that we can see how the subforms are related.
Do the subforms have their data source in a different table to the main form or the same table?
What are the Maser/Child links between the Main form and the subforms
You may need to relate to the Mainform and subform in your VB
i.e
Forms!frMainform!frmSubform!txtID.value = ID

or use the me.frmsubform form of reference.

swoozie
06-16-2006, 12:37 PM
cant really post :( but let me narrow down a bit.

I need to pull in a value from a field in the parent form for a action in a subform. I did assign it to a variable, but I would like to be able to refence the parent field just incase the variable loses its value.

CFDM
06-19-2006, 01:51 PM
use the expression builder to point to where you need the linked data

Cosmos75
06-19-2006, 09:10 PM
Maybe this may help, if it's an issue with properly referencing parent and/or sub forms.

How to refer to a form, its' sub-form and sub-sub-form (http://accessdb.info/index.php?option=com_content&task=view&id=112&Itemid=45)

Imdabaum
06-26-2006, 08:49 AM
I had a similar problem where I had a new form pop up on an event from the main form where a new record was added. I went to properties and in the data tab inserted [forms]![frmMainform]![ID] as the default value and kept the data source as the table I wanted to store the new record in. It seemed to work for me.