473,385 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to add data from one form to another

hi everybody-

what is the best way to add data from one form to another?

i have 2 tables: person and contract. here are some of the fields.

table: person

personid (autonumber and primary key)
ss#
firstname
lastname
address1
adress2
city
state
zip
phone

table: contract
contractid (autonumber and primary key)
contracttype
startdate
enddate
employeeid
personid (foreign key to person table)

there is a 1 to many relationship between person and contract.

a person can have 1 or more contracts.
a contract can have 1 and only 1 person.
i have a question about 2 of my forms. my first form, frmPerson, is
based on the person table. it is a simple form to enter information
about a person. i used personid as the primary key and as an autonumber
so that every time i add a new person, the personid automaticaaly
increments by 1.

now, my second form may be hard to explain. my form, frmContract, is
based on a query that includes both of my tables: person and contract.
i set up a query in the query design window. my query includes both
tables: person and contract. i set up a relationship line between
person.personid and contract.personid. i included *all* my fields from
both tables.

my form, frmContract, has all of the fields from the person table at
the top and all of the fields from the contract table at the bottom.
to open this form, i have a command button on another form that when
clicked opens up a blank frmContract. I have a combo box that is based
on the person table.

the combo box, cboPerson, has these 4 fields: personid, ss#, lastname,
firstname.

when i select a person, then all of the fields that are "person"
information are supposed to be populated. for example: after i select
a person in my combo box, the person fields (ss#, lastname, firstname,
address1, address2, city, state, zip, phone) are supposed to be
populated with the matching information. then once i start entering
data into one of the fields associated with the "contract"
information, i.e. startdate, the contractid autonumber field
automatically fills in with the next vavailable number. i say "supposed
to" because it doesn't.

let me give you a little background. the primary key of my person table
used to be ss#. but i wanted the possibility to add alternate address
information or other alternate information about the same person. so, i
added the personid field to my person table and made it both an
autonumber and the primary key.

when ss# was the primary key of my person table, the combo box on my
contract form worked ok. whenever i'd go to add a new contract, i'd
click the "add new contract" command button on my form, a new contract
form would pop up with the person fields blank and the contract fields
blank. then when i selected a person from the combo box (cboPerson had
the 3 fields: ss#, lastname, firstname), all of my "person" fields
would be populated with the correct information. for example: the last
name field would have the matching last name, the first name field
would have the matching first name, etc... only the "contract" fields
would be left blank. then once i started to enter any information into
any of the "contract" information fields (i.e. startdate), the
contractid autonumber field would automatically be populated with the
next available autonumber.

however after i added the new personid attribute to my person table and
changed the primary key from ss# to personid, i started to run into
these problems. i thought i could alter/ add a new combo box based on
personid and it would work. by the way, i added a text box to show the
ss#. but my new combo box was based on the fields: personid, ss#,
lastname, firstname. the combo box would store personid and the
attributes ss#, lastname, firstname in the combo box were added to
help discern one person from another.

so basically i'm stuck. now when i click on the combo box, it will open
but it makes an error noise when i try to select a person. it won't
let me select a person. it used to when i used ss# as the primary key
of my person table and as the foreign key in the contract table.

does anybody have any suggestions?

is it that my form doesn't like 2 autonumbers? i get an error, "control
can't be edited; it's bound to autonumber field 'personid.'

all of my fields on my form are bound to the fields from my query. my
query is based on both tables: person and contract.

is there a better way? what if i add a command button to the bottom of
my person form. this would some how open my contract form and then
populate all of the "person" information fields with the information
already entered on the person form. how would i automatically populate
all of the "person" information fields on the contract form?

thanks for reading my post! i know it's really long and redundant, but
i tried to be as clear as possible.

thanks,

megan

Nov 13 '05 #1
1 3529
I believe you're going to do better with a form/subform setup. You'll need
to change the query in your frmContract form, and only show data in the
contract table. Drag this form into the frmPerson form, and you'll have a
subform which should automatically update based on the personid in the main
form. In other words, Access will do all of the work for you, and this form
will function like many standard Windows applications.

If you need more help, first look up forms/subforms in the help file, and
post additional questions to this site.

HTH
JV
<me**************@hotmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
hi everybody-

what is the best way to add data from one form to another?

i have 2 tables: person and contract. here are some of the fields.

table: person

personid (autonumber and primary key)
ss#
firstname
lastname
address1
adress2
city
state
zip
phone

table: contract
contractid (autonumber and primary key)
contracttype
startdate
enddate
employeeid
personid (foreign key to person table)

there is a 1 to many relationship between person and contract.

a person can have 1 or more contracts.
a contract can have 1 and only 1 person.
i have a question about 2 of my forms. my first form, frmPerson, is
based on the person table. it is a simple form to enter information
about a person. i used personid as the primary key and as an autonumber
so that every time i add a new person, the personid automaticaaly
increments by 1.

now, my second form may be hard to explain. my form, frmContract, is
based on a query that includes both of my tables: person and contract.
i set up a query in the query design window. my query includes both
tables: person and contract. i set up a relationship line between
person.personid and contract.personid. i included *all* my fields from
both tables.

my form, frmContract, has all of the fields from the person table at
the top and all of the fields from the contract table at the bottom.
to open this form, i have a command button on another form that when
clicked opens up a blank frmContract. I have a combo box that is based
on the person table.

the combo box, cboPerson, has these 4 fields: personid, ss#, lastname,
firstname.

when i select a person, then all of the fields that are "person"
information are supposed to be populated. for example: after i select
a person in my combo box, the person fields (ss#, lastname, firstname,
address1, address2, city, state, zip, phone) are supposed to be
populated with the matching information. then once i start entering
data into one of the fields associated with the "contract"
information, i.e. startdate, the contractid autonumber field
automatically fills in with the next vavailable number. i say "supposed
to" because it doesn't.

let me give you a little background. the primary key of my person table
used to be ss#. but i wanted the possibility to add alternate address
information or other alternate information about the same person. so, i
added the personid field to my person table and made it both an
autonumber and the primary key.

when ss# was the primary key of my person table, the combo box on my
contract form worked ok. whenever i'd go to add a new contract, i'd
click the "add new contract" command button on my form, a new contract
form would pop up with the person fields blank and the contract fields
blank. then when i selected a person from the combo box (cboPerson had
the 3 fields: ss#, lastname, firstname), all of my "person" fields
would be populated with the correct information. for example: the last
name field would have the matching last name, the first name field
would have the matching first name, etc... only the "contract" fields
would be left blank. then once i started to enter any information into
any of the "contract" information fields (i.e. startdate), the
contractid autonumber field would automatically be populated with the
next available autonumber.

however after i added the new personid attribute to my person table and
changed the primary key from ss# to personid, i started to run into
these problems. i thought i could alter/ add a new combo box based on
personid and it would work. by the way, i added a text box to show the
ss#. but my new combo box was based on the fields: personid, ss#,
lastname, firstname. the combo box would store personid and the
attributes ss#, lastname, firstname in the combo box were added to
help discern one person from another.

so basically i'm stuck. now when i click on the combo box, it will open
but it makes an error noise when i try to select a person. it won't
let me select a person. it used to when i used ss# as the primary key
of my person table and as the foreign key in the contract table.

does anybody have any suggestions?

is it that my form doesn't like 2 autonumbers? i get an error, "control
can't be edited; it's bound to autonumber field 'personid.'

all of my fields on my form are bound to the fields from my query. my
query is based on both tables: person and contract.

is there a better way? what if i add a command button to the bottom of
my person form. this would some how open my contract form and then
populate all of the "person" information fields with the information
already entered on the person form. how would i automatically populate
all of the "person" information fields on the contract form?

thanks for reading my post! i know it's really long and redundant, but
i tried to be as clear as possible.

thanks,

megan

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Randell D. | last post by:
Folks, Perhaps someone can figure this out - this is 'the process of my script' I have a form whereby I can add multiple contacts to a single address. There is only one...
32
by: Neil Ginsberg | last post by:
We're using SQL Server 7 with an Access 2000 MDB as a front end with ODBC linked tables. I recently created a new set of tables for the app, and users are complaining that unsaved data is being...
2
by: Iain Miller | last post by:
Struggling a bit here & would be grateful for any help. I have a table which has a list of people in it. Each person has a unique ID automatically allocated by Access but also belongs to one of 5...
2
by: Matt | last post by:
When we submit the form data to another page, we usually do the following: <form action="display.aspx" method="post"> will submit the form data and open display.asp in the current browser ...
2
by: ejs | last post by:
Please read the entire reponse, hopefully this clears up your questions. The data used that needs to go into the batchupload page comes from a server. My problem is that currently I write a file...
17
by: stathis gotsis | last post by:
Hello everyone, I am tying to come up with an elegant way to process some input data that come from a form. When the user hits the 'Submit' button, i want the form to appear again with the...
5
by: Chris | last post by:
I have a meetings section I'm developing on our intranet. Using PHP/MySQL. Meeting info and Meeting docs reside on 2 related tables in the db. Users may want to upload anywhere from 1 to 10 or...
4
by: Cerebral Believer | last post by:
Hi I need help! Forgive me I am a PHP newbie. I have a small script that enables me to send a form from an HTML page. I want to use the HTML formatted form because the design of my website is...
22
by: Zytan | last post by:
I have public methods in a form. The main form calls them, to update that form's display. This form is like a real-time view of data that is changing. But, the form may not exist (it is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.