copy data from one form to another

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to close a form, save the data, open another and then have the
primary key data copy to the form that I told Macros to open, thus
elliminating the need to have both forms open, and then copy the data?
Please help.
 
You have to store the value somewhere that you can remember what it was so
that you can pass it to the form you are opening or let the form retrieve
the value once it opens.

Options:
1) Hide the form you're closing instead of closing it. Once you're done
passing the value, then close it.

2) Get the value and store it in a variable that has sufficient scope that
the variable's value can be retrieved by the new form.

3) Get the value and pass it in the OpenForm command in the Where argument
or as a OpenArgs argument.

4) Have a Property in your database that will hold this for you and retrieve
it from there.

5) Store the value in the registry then retrieve it.

6) Store the value in a field in a table in such a way that you will know
what the last entry was (i.e. possible store a date and time in another
field of the same record). This could be problematic if other users are also
using the database and could add another record between the time you add
yours and open the new form.

7) Save the value to a temporary file and retrieve it from there. Of course
you would have to also remember the name of the temporary file, so you might
as well just remember the value instead.

While options 4-7 can work, I recommend 1-3. Option 1 is probably the
easiest.

--
Wayne Morgan
MS Access MVP


"(e-mail address removed)"
 
I am trying to close a form, save the data, open another and then have the
primary key data copy to the form that I told Macros to open, thus
elliminating the need to have both forms open, and then copy the data?
Please help.

Well... a couple of concerns here.

Data is not stored in Forms. A Form is just a tool, a window which
lets you store data in a table.

Secondly, you should very, very rarely need to store the same data
redundantly in two different places. Store the data ONCE and then use
Queries to look it up.

WHat are these two forms? Why do you need to copy data from one to
another? Could you perhaps use a Form with a Subform to link the data
in two tables?

John W. Vinson[MVP]
 
I am trying to create a database that uses many differnent tables to do what
I need it too do. I need the number to be the same in about 30 tables so that
when I run the Query that I want, I get all the results that are associate
with that particular number. Thanks
 
I am trying to create a database that uses many differnent tables to do what
I need it too do. I need the number to be the same in about 30 tables so that
when I run the Query that I want, I get all the results that are associate
with that particular number. Thanks

I cannot imagine a database that needs records created automagically
in 30 tables.

Creating an empty "placeholder" record, with only a foreign key field,
in a "child" table should NEVER be necessary. Ordinarily, one would
use a Form with Subforms, using the linking field as the master/child
link field of the subform; this will ensure that *when there is data*
put into a child table (but not before!) that the ID field is
correctly updated.

Could you describe your "sea urchin" table relationships? What are
these 30 tables, and why are they all related to one single master
table?

John W. Vinson[MVP]
 
I am trying to create an emergancy network database for my county here in
Florida. We need to be able to put in a "Personal ID #" for individuals, and
then as we go to add other data about the person on various other forms from
other tables, we need that number to come with us and be linked to all the
coresponding table that have that information in them.
 
I am trying to create an emergancy network database for my county here in
Florida. We need to be able to put in a "Personal ID #" for individuals, and
then as we go to add other data about the person on various other forms from
other tables, we need that number to come with us and be linked to all the
coresponding table that have that information in them.

Then put the other forms onto the Personnel table as Subforms, and use
the Personal ID # as the Master/Child Link Field. That's precisely
what this feature is designed to do!

Or, you can put a combo box with the ID # as the bound column onto
forms for the other tables to allow selection of a person by name.


John W. Vinson[MVP]
 
Back
Top