473,748 Members | 10,737 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Em ployerID field i have the control
source set to tblLocations_Em ployerID and the row source set to
tblEmployers.Em ployerID. 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 2362
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.Em ployerID field i have the control
source set to tblLocations_Em ployerID and the row source set to
tblEmployers.Em ployerID. 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*********@nat pro.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.Em ployerID field i have the control
source set to tblLocations_Em ployerID and the row source set to
tblEmployers.Em ployerID. 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*********@nat pro.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.Em ployerID field i have the control
source set to tblLocations_Em ployerID and the row source set to
tblEmployers.Em ployerID. 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.c omwrote in message
news:11******** **************@ h48g2000cwc.goo glegroups.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*********@nat pro.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.Em ployerID field i have the control
source set to tblLocations_Em ployerID and the row source set to
tblEmployers.Em ployerID. 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
3581
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 relationship). I have fields called InventoryOut and BalanceEnd that are calculated on the fly for reports and when displayed on forms (they are not part of any table). I have another field called "BalCarFor" (Balance Carried Forward) that is part of the...
2
3756
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 the subform has a check box, "invoiced". Currently, my print report button has the folowing code:
0
1846
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 multiple slide records per CutID. This table is a subdatashet of the Cut table--so the CutId is stored in it I have a form based on a query between the 2 tables for adding slide records
11
4532
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 database,just help in getting me pointed in the right direction. I have a database with 8 tables, which from what I have read, cannot be linked on a single form, and be updatable. I have created a query which includes all 8 tables, and then...
3
3653
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" through "Phase 10" (there are 10 Phases I want to sort from) Once the phase has been selected a second combo box would populate.
2
946
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 making this work...
7
15658
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 there an equivalent property for the DataGridView? I have searched, but have not found one. I would like the user to be able to see all the columns of the table on one screen - thus eliminating the need to use the horizontal scroll bar to view...
1
4167
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 allows me to filter based on variables in a single table. I would like to have a search form where I can select multiple variables (from various linked tables) to filter by, and return results based on this multi-table filter. Allen Browne...
58
8115
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 the parts section an i seem to be having trouble. When i try to insert into the parts section i get the error Invalid character value for cast specification. But not sure what i am doing wrong. Here is what i am using to insert. All the sections...
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8830
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9541
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9321
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8242
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3312
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.