473,396 Members | 1,734 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,396 software developers and data experts.

multiple table form based on a query

Here is my table design:

tblEmployers
EmployerID autonum (primary key)
EmployerName text

tblLocations
LocationID autonum (primary key)
EmployerID longint (foreign key)
LocationAdress text
LocationCity text
Location ...
...
...

what i am trying to do is have a form where you can enter a new
location, and when you type in the employer name it will either look up
the EmployerID in the tblEmployers table and insert it into the
tblLocations table, or if it doesn't exist, create a new entry in the
tblEmployers Table and insert the new EmployerID into the tblLocations
table. I am not sure exactly how to do this... right now i have a
query that just includes all fields from both tables, and a form based
on that query. in the tblLocations.EmployerID field i have the control
source set to tblLocations_EmployerID and the row source set to
tblEmployers.EmployerID. this allows me to enter a new employer,
putting the right data in both tables EmployerID, but it will create a
new entry in the tblEmployers table even if the EmployerName already
exists.

Am i on the right track, or is there a better way to do this?

Nov 7 '06 #1
4 2337
create a form based on employers

create a continuous form based on locations

open the employers form and drag the locations form to it... creating a
subform, linked by employerId

now you can add a employer and one-or-more locations
or you can search for any existing employer and add/delete locations

Deus402 wrote:
Here is my table design:

tblEmployers
EmployerID autonum (primary key)
EmployerName text

tblLocations
LocationID autonum (primary key)
EmployerID longint (foreign key)
LocationAdress text
LocationCity text
Location ...
...
...

what i am trying to do is have a form where you can enter a new
location, and when you type in the employer name it will either look up
the EmployerID in the tblEmployers table and insert it into the
tblLocations table, or if it doesn't exist, create a new entry in the
tblEmployers Table and insert the new EmployerID into the tblLocations
table. I am not sure exactly how to do this... right now i have a
query that just includes all fields from both tables, and a form based
on that query. in the tblLocations.EmployerID field i have the control
source set to tblLocations_EmployerID and the row source set to
tblEmployers.EmployerID. this allows me to enter a new employer,
putting the right data in both tables EmployerID, but it will create a
new entry in the tblEmployers table even if the EmployerName already
exists.

Am i on the right track, or is there a better way to do this?
Nov 7 '06 #2
thats not exactly what i am looking for...

what i am looking for is the ability to enter all the data for one
location and employer in one shot, when a new employer is added, but
prevent the user from entering employer as new if it already exists.
even with your subform design, you can still enter a employer name that
already exists and it creates a new key for it. should i just chnge my
table so the primary key is the employer name? it seems kind of silly
to have a table with only one column. maybe i should just have the
employer name in the locations table and not worry about normalization?
the ultimate goal here is to have a link on the main switchboard for
new data entry, because most employers will only have one location when
they are newly entered. i have a separate form for adding a location to
an existing employer... which is almost working like i want it to, but
thats another story.

i appreciate the help, i took an access class at the local university,
but it was so basic that it didn't really help...

le*********@natpro.com wrote:
create a form based on employers

create a continuous form based on locations

open the employers form and drag the locations form to it... creating a
subform, linked by employerId

now you can add a employer and one-or-more locations
or you can search for any existing employer and add/delete locations

Deus402 wrote:
Here is my table design:

tblEmployers
EmployerID autonum (primary key)
EmployerName text

tblLocations
LocationID autonum (primary key)
EmployerID longint (foreign key)
LocationAdress text
LocationCity text
Location ...
...
...

what i am trying to do is have a form where you can enter a new
location, and when you type in the employer name it will either look up
the EmployerID in the tblEmployers table and insert it into the
tblLocations table, or if it doesn't exist, create a new entry in the
tblEmployers Table and insert the new EmployerID into the tblLocations
table. I am not sure exactly how to do this... right now i have a
query that just includes all fields from both tables, and a form based
on that query. in the tblLocations.EmployerID field i have the control
source set to tblLocations_EmployerID and the row source set to
tblEmployers.EmployerID. this allows me to enter a new employer,
putting the right data in both tables EmployerID, but it will create a
new entry in the tblEmployers table even if the EmployerName already
exists.

Am i on the right track, or is there a better way to do this?
Nov 7 '06 #3
Nevermind, i went with a different design.
Deus402 wrote:
thats not exactly what i am looking for...

what i am looking for is the ability to enter all the data for one
location and employer in one shot, when a new employer is added, but
prevent the user from entering employer as new if it already exists.
even with your subform design, you can still enter a employer name that
already exists and it creates a new key for it. should i just chnge my
table so the primary key is the employer name? it seems kind of silly
to have a table with only one column. maybe i should just have the
employer name in the locations table and not worry about normalization?
the ultimate goal here is to have a link on the main switchboard for
new data entry, because most employers will only have one location when
they are newly entered. i have a separate form for adding a location to
an existing employer... which is almost working like i want it to, but
thats another story.

i appreciate the help, i took an access class at the local university,
but it was so basic that it didn't really help...

le*********@natpro.com wrote:
create a form based on employers

create a continuous form based on locations

open the employers form and drag the locations form to it... creating a
subform, linked by employerId

now you can add a employer and one-or-more locations
or you can search for any existing employer and add/delete locations

Deus402 wrote:
Here is my table design:
>
tblEmployers
EmployerID autonum (primary key)
EmployerName text
>
tblLocations
LocationID autonum (primary key)
EmployerID longint (foreign key)
LocationAdress text
LocationCity text
Location ...
...
...
>
what i am trying to do is have a form where you can enter a new
location, and when you type in the employer name it will either look up
the EmployerID in the tblEmployers table and insert it into the
tblLocations table, or if it doesn't exist, create a new entry in the
tblEmployers Table and insert the new EmployerID into the tblLocations
table. I am not sure exactly how to do this... right now i have a
query that just includes all fields from both tables, and a form based
on that query. in the tblLocations.EmployerID field i have the control
source set to tblLocations_EmployerID and the row source set to
tblEmployers.EmployerID. this allows me to enter a new employer,
putting the right data in both tables EmployerID, but it will create a
new entry in the tblEmployers table even if the EmployerName already
exists.
>
Am i on the right track, or is there a better way to do this?
Nov 7 '06 #4
Just make it an index - no duplicates

Kevin C
"Deus402" <dp****@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
thats not exactly what i am looking for...

what i am looking for is the ability to enter all the data for one
location and employer in one shot, when a new employer is added, but
prevent the user from entering employer as new if it already exists.
even with your subform design, you can still enter a employer name that
already exists and it creates a new key for it. should i just chnge my
table so the primary key is the employer name? it seems kind of silly
to have a table with only one column. maybe i should just have the
employer name in the locations table and not worry about normalization?
the ultimate goal here is to have a link on the main switchboard for
new data entry, because most employers will only have one location when
they are newly entered. i have a separate form for adding a location to
an existing employer... which is almost working like i want it to, but
thats another story.

i appreciate the help, i took an access class at the local university,
but it was so basic that it didn't really help...

le*********@natpro.com wrote:
>create a form based on employers

create a continuous form based on locations

open the employers form and drag the locations form to it... creating a
subform, linked by employerId

now you can add a employer and one-or-more locations
or you can search for any existing employer and add/delete locations

Deus402 wrote:
Here is my table design:

tblEmployers
EmployerID autonum (primary key)
EmployerName text

tblLocations
LocationID autonum (primary key)
EmployerID longint (foreign key)
LocationAdress text
LocationCity text
Location ...
...
...

what i am trying to do is have a form where you can enter a new
location, and when you type in the employer name it will either look up
the EmployerID in the tblEmployers table and insert it into the
tblLocations table, or if it doesn't exist, create a new entry in the
tblEmployers Table and insert the new EmployerID into the tblLocations
table. I am not sure exactly how to do this... right now i have a
query that just includes all fields from both tables, and a form based
on that query. in the tblLocations.EmployerID field i have the control
source set to tblLocations_EmployerID and the row source set to
tblEmployers.EmployerID. this allows me to enter a new employer,
putting the right data in both tables EmployerID, but it will create a
new entry in the tblEmployers table even if the EmployerName already
exists.

Am i on the right track, or is there a better way to do this?

Nov 7 '06 #5

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

Similar topics

3
by: Steven Stewart | last post by:
Hi there, I have posted about this before, but yet to arrive at a solution. I am going to try to explain this better. I have an Employees table and a Datarecords table (one-to-many...
2
by: Craig M | last post by:
Hi, I have a form, frmInvoices and a subform, frmInvoicesSub. On the parent form, i have a "print report" button, that prints a report depending on an ID on the parent form. Each record in...
0
by: allyn44 | last post by:
HI--I have 2 tables Cut: cut ID, HistNumb, Block, date: Cut Id is the primary key, the other 3 fileds are indexed to be unique Slides: Cutid SlideID, and various other fields: there can be...
11
by: dskillingstad | last post by:
I've been struggling with this problem for some time and have tried multiple solutions with no luck. Let me start with, I'm a novice at Access and I'm not looking for someones help to design my...
3
by: hmiller | last post by:
Hey everyone, I am having a hell of a time trying to set this menu system up. Here's what I'm trying to do. Combo Box One; is populated by names under properties "row source" "Phase 1"...
2
by: fstenoughsnoopy | last post by:
I have a customer order database and I need to pull a customers information, ie first name, last name, address, city, state, zip, phone, etc, into the oder table. i don't know how to go about...
7
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
1
by: jcf378 | last post by:
Hi all-- Does anyone have any insight as to how I might create a search form that allows a user to select criteria based on any related table in the whole database. The search form I have now only...
58
by: bonneylake | last post by:
Hey Everyone, Well recently i been inserting multiple fields for a section in my form called "serial". Well now i am trying to insert multiple fields for the not only the serial section but also...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.