Passing values from one form to another

  • Thread starter Thread starter ReidarT
  • Start date Start date
R

ReidarT

I have one form with a date of birth combofield amongst other fields.
I use the 'not in list event' to open another form to register a new person.
When closing the second form, (tblPerson), I get form1 (tblSales) filled
with the new data.
This works good as long as there is a new date of birth.
Problem occurs when I want a new person with a date of birth already
registered.
I need a unique field to retrieve the new values.
I have PersonID as unique field in second form (tblPerson), but I dont know
how to pass the new PersonID value from second form to form1.

regards
reidarT
 
Have you considered using a subform? I am not an Access expert but I know it
is easy for a subform to access it's parent.

If it is not possible to use a subform or if there is any reason you don't
want to, then hopefully someone (maybe me) will be able to answer your
question as you asked it; that is, how to do it using a separate form.
 
Hi
It is not possible to use a subform in this situation.
Situation is:
form 1, combobox with date of birth.
If date of birth is new, I use not in list event, adds new data in a second
form (form 2) and then retrieves the newly registered data to form 1.
If date of birth exists I still need to add new persons with the same date
of birth into form 2 (with underlaying table)
When returning to form 1 I have to refresh the combobox to make the new
person appear in the combobox-list and then select him. Every person has a
unbique PersonID field.
regards
reidarT
 
Most of what you are saying was said in the original question. However I
don't see anything relevant to the possibility of using a subform. As far as
I know, it is possible to use a subform; perhaps it is just a matter of
knowing how to. I do not intend to insist that you use that solution, but I
just want to ensure you understand that it is possible.

Perhaps the confusion is the result of thinking that a subform must have
something that links (that Access does automatically) it to the main form
and/or the main form must have something that links it to the subform. That
is not necessary; a subform can be contained within a main form and you can
determine in your code where the data for the subform comes from and such. I
am not familiar with all the possibilities but there are many.
 
Back
Top