Tables :: Adding Record To Multiple Tables
Aug 19, 2015
I am using Access 2007 on my front-end and SQL Server 2014 on the back-end. I have a table of Car Dealers and a table of contacts at the dealerships. These tables are SQL tables. The user can select a dealer and then see everyone that works at that dealership. When they look at this there is a field called Email. This is a hyperlink that they can click on to open Outlook and send an email. The table called DealerEmails is an Access table. My table layout is:
Dbo_Dealers
------------------
ID (PK)
DealerName
DealerAddress
DealerCity
DealerState
DealerZip
DealerPhone
ModifiedBy
ModifiedDate
Dbo_DealerContact
---------------------------
ID (PK)
LastName
FirstName
Postion
DealerID (FK)
ModifiedBy
ModifiedDate
DealerEmails
-----------------
ID (PK)
DealerContactID (FK)
Email
ModifiedBy
ModifiedDate
Now I'm trying to write the code to add a new contact. My code works but I need to obtain the AutoNumber from When I add a new record to the table dbo_DealerContact. My code is:
Code:
Option Compare Database
Option Explicit
Dim adoDealerContacts As New ADODB.Recordset
Dim daoDealerEmails As DAO.Recordset
Private Sub cmdSave_Click()
[Code] ....
I tried to add Me.Dirty=False, but this still returned a value of 0 into my variable intDealerContactID.
I also tried moving intDealerContactID = .Fields("ID").Value outside of the With block.
I'm aware that there is a command in SQL @@Identity. But I'm unsure how to use it in this context.
Is there a way to get the primary key from dbo_DealerContacts so I can insert that into my Emails table?
View Replies
ADVERTISEMENT
Feb 27, 2007
I have three tables setup in a 1 to 1 relationship using a Autonumber field as their primary keys. I created the seperate tables to group related data together and reduce the tables sizes in general. So think of it as one main table and two tables of extended data.
I need to be able to add a record to table 1 and have it use the same autonumber to reserve that row for data in tables 2 & 3 so that my relationships stay in sync. I want to update the data in tables 2 & 3 later when that information is available.
I have been breaking the database testing some things out like building a form from a select query using all three tables. When I add the record to table 1 nothing is added to the other two. Things get messy on subsequent attempts to add data to any of the tables.
I have avoided this problems in other tables by not using the autonumber datatype, however, I don't have a good unique key that can be manually entered and kept accurate, so autonumber solves that problem in this case.
My VB is very rusty but I'm thinking there should be a way, before update, to capture the autonumber being used for the new record and write it to the other tables. I'm thinking that would be one solution, but I can't seem to get started on that code. Any help or examples would be great.
Thanks,
Jim
View 4 Replies
View Related
Jun 6, 2013
I have a main table with subject id and other fields. I also have 16 other tables which have questionnaire information at 17 different timepoints. In those tables, the subject id is the only connected field between the main table and 17 different years. When I add a new record (by subject id) on the main table, I want it to add that same subject id to the 17 other tables because that subject id will eventually get all 17 years worth of data. But even using subforms, it will not add a new subject to the other tables unless I add some sort of information such as (date received) into the subform.
View 6 Replies
View Related
Mar 13, 2014
I am new with Access and I am setting up a data base that will have 16 tables and each table with have over 3,000 customers. The reason for 16 tables is that we will be inputting information on a monthly basis for each of these customers (12 of the tables) and I also have 4 tables that will be perfomring different "tasks" for each customer (one is just to keep the notes we make for each customer, one will be to show any billing done, one is going to be a summary of the entire year along with some additioanl information not entered elsewhere and the final one is our customer information table).
The customer account number is the primary key for all of my tables.I want to know how I can add a new customer (either using query or form) at one time that will populate all the tables. Right now I have everything set up as tables but I can set up queries if need be.
View 14 Replies
View Related
Oct 24, 2005
hi, i am new to access and struggling so any help would be great...
i have a db with 3 tables. students contains a Primary Key ('studentid') and then 'firstname' and 'lastname' fields. The two other tables (contactdetails, coursedetails) have 'studentid' as a Primary Key and then they each have other fields.
I set up relationships between the tables (1 to 1) but i would now like to create a form that will allow me to enter data to all three tables at the same time. (this would be ideal as it keeps the data normalised) if this isn't possible i would like to create a form that adds the 'studentid' record to each of the tables.
let me know if you need anymore details but if someone can point me in the right direction it would be cool.
cheers
View 11 Replies
View Related
Dec 8, 2006
Hello,
I have around 10 mdbs and in each I have 4 tables, I want to add all the tables from 10 mdb to one mdb, finally I will have 4 toal tables, right now I am using a appendquery to add tables. Is there way using VBA I can do it on the form and with one click of a button I will be able to add. Thanks for any info..
View 1 Replies
View Related
Jul 31, 2013
I am new to Access here, and looking to start up a database that will contain data for thousands of footballers.
I have on one table ("Directory"), all 5000+ players, with nationalities, names etc, and on another ("Flags"), I have all nations of the world and their respective flags (as an attachment).
How do I add the flag of a players nation into the "Directory" table for each record? Is there a quick way? I've tried "Lookup" but it won't let me do it for images, I've tried "Relationships" but without success.....surely I don't have to go through the "add attachment" process for all 5000 records?
View 3 Replies
View Related
Sep 20, 2004
OK I'm totally lost again.
What I want to do is;
Use one form to add records into several tables.
I have seperated my data into seperate tables and set up one to many relationships.
tblincident
--------------
Key#
Report#
Time
Date
Location
tblPerson
----------------
Key#
Last Name
First Name
Middle Name
Address
etc.
tblItem
----------------
Key#
Make
Model
Serial#
etc.
What i want to do is use one form to enter all this data into the different tables.
There can only be one record in tblIncident that can match multiple records in the other tables.
i.e. for each record in tblIncident, I want to be able to have the capability to have as many persons related to that incident as I need.
I was thinking about setting up a tabctl for the data that has to be entered for tblIncident and then change the property setting for it to go away and then have the next tabctl appear in it's place for entering data into the next table. The problem I am having is that apparently I can only have one table as the control source for the form.
So next I tried using subforms, but that isn't working either. I can't figure out how to make the subform appear in a specific place on my form, sized in specific dimensions I want where I want.
I am just starting to learn about this relationships stuff and it's kind of difficult. How do you make it where you can do this from one form? Do I need to make a query of some sort?
Any help is appreciated.
View 1 Replies
View Related
Mar 11, 2014
I want to make a table where in I have to input atleast 10 numbers in one reference ID which there is a start time and end time.
A form with inputing one reference ID and then adding multiple numbers at once and saving the data with a start time and end time. Is it possible to capture the time for that specific reference ID?
How to do it or a sample tracker on measuring it.
View 14 Replies
View Related
Mar 2, 2015
I am new to access but I am familiar with SQL databases. I have two tables: one for project data and another for project leader data. These tables are linked by a third table that relates projectIDs to leaderIDs. I am currently working on making a form that will go through each project and display the people involved in each project in a subform. I pulling the data from the the leader table that matches the the projectID with a query.
I would like to be able to update the information in this subform directly (which I can currently do) and be able to add new project leaders to a project. What is the best way to add the new leader to this? If a person is already in the database how do I add them with the form without re-adding new information to the table?
View 3 Replies
View Related
Jun 15, 2006
Hello!
It's been a while since I've asked a question here, but I can't seem to figure this problem out.
I am setting up a form using data from 4 different tables, all related, and I can't figure out how to add fields that I didn't initially add during the wizard set-up. I used the wizard because it's easier for me to do that and then go in and make the changes I want to make.
When I get data from just one table, all of the available fields from that table are in the "Field List" no matter what fields I chose to include in the wizard process. That's good. But when I get data from more than one table, only the fields I initially chose in the Wizard process are showing up in the field list. I can't figure out how to add a new and different field from one of those tables.
The way I "solved" this problem the first time was to start over, creating my form from scratch--but now that I've done a lot of work, it just occurred to me that I will need to add 2 more fields. (I actually don't even have those fields in a table yet, but I will add them later.) So, this will be an ongoing problem. Since this form will get much use, by several people, I don't want to have to re-create it every time I want to change something.
So, is this possible? How can I add another field?
Also, while I am at it... A combo box was working beautifully to look up specific records when I was gathering information from only one table. It isn't working anymore.
Thanks in advance!
-Siena
View 8 Replies
View Related
Mar 27, 2014
I am creating a table in access 2010 for my consumable and bench stock report. I made a 12 fields which I name it the month of the year and another 1 field to add the total disburse materials in one whole year. I did this formula to add the 12 fields
[Jan]+[Feb]+[Mar]+[Apr]+[May]+[Jun]+[Jul]+[Aug]+[Sept]+[Oct]+[Nov]+[Dec].
But the problem is its just adding the complete consecutive months that I disburse and the row with blank section the total disburse doesn't show on the total disburse for the whole year. I try to use the code =Nz([Total Disburse],0) but it shows on the screen i cannot be used in calculated column.
View 4 Replies
View Related
Dec 2, 2011
Supposing you have 4 Tables
1.)User
2.)Admin
3.)Teacher
4.)Pupil
Now the "User" table has the ff. fields: ID(auto num),FName,MName,LName,User,Pass,Type.
Now what I want to do is, if I add a new a record in the table "User" and if the record has the data "Admin" in the field "Type" then the record should also be saved in the table "Admin" but if the data is "Teacher" or "Pupil" then it should be also saved in their respective tables.
Question is: Is that possible? If yes, then how??
View 5 Replies
View Related
Jun 27, 2005
Hello, I am a newbie in this forum.
Recently, I am helping my friend to write a simple accounting software based on Access. I have finished most of the neccessary tables, forms and reports by following the Microsoft Sample Database (NorthWind).
The following is my difficulties:
I want to have another table (bank) to store up
1.the amount of each customer need to pay by checking each order's customerID
2. The amount the customer has paid so far, so i can know how much he/she still need to pay
In order to update this table, once there is new order added in the order table, i need to know that and update it, but how? I have used a form and subform to input the order detail, and the order table is automatically updated once data is input. How can i trigger the update of the "bank" table??
View 2 Replies
View Related
Oct 20, 2006
Hi, I have 7 tables in my database and 1 form corresponding to all the fields in these tables (linked by a query by recordsource). My problem is that the form will only show a record if ALL 7 tables have manually had the primary key entered (not good when i have information that needs to be added at different times). How can I make it such that if I create a new record on the form that all primary key fields will be updated, and this record will be present every time i open my the form??
Cheers
Tania :o
View 2 Replies
View Related
May 12, 2015
I have a table A in which I write down orders for cars. A record is an order. A single order may contain multiple cars in varying quantities.Each car has its components. Some cars may have some of their components common. There is a table B which indicates each car and its components required with their quantities required to build the car. There is a record for each different car.
Now suppose there is a new car we are going to produce so we need a new record in table B for the car and all its components. Also we need a new field in table A because people can now order the new car(in some quantity).
With form for table B we can introduce a new record. But how can we add a field in table A automatically after a record is added in table B?
View 9 Replies
View Related
Mar 17, 2005
I am trying to create a form (TriageForm) that will enter a new record on all tables in the access database. Is there an easy way to do this?
This is my setup:
TriageTable
MRN (unique identifier)
age
sex
Nurse
Dr
Room
PhysicianRecordTable1
MRN
History
FamilyHx
SocialHx
PhysicianRecordTable2
MRN
Assessment
Plan
View 1 Replies
View Related
Nov 29, 2007
Can a Append Query move all my data stored in multiple tables to another database with a identical table structure?
Because as I try to work the query, I keep getting prompted to "Select a table" I want to append to, and I don't want to append to just one table...
View 4 Replies
View Related
Mar 26, 2005
I am making a master form for three tables which ultimately form a hierarchy. I am getting all the fields from each table onto one form. By default the record source would be made up of an INNER JOIN such as below
SELECT PERSON.first_name, PERSON.country, PERSON.last_name, PERSON.street, PERSON.area, PERSON.city, PERSON.telephone, CONTRIBUTOR.registration_date, CONTRIBUTOR.fav_category, MUJAHED.profession FROM (PERSON INNER JOIN CONTRIBUTOR ON PERSON.id=CONTRIBUTOR.id) INNER JOIN MUJAHED ON CONTRIBUTOR.id=MUJAHED.id;
I'm trying to change the record source to match using the where clause instead. However the following allows me to view but not add a new record
SELECT PERSON.first_name, PERSON.country, PERSON.last_name, PERSON.street, PERSON.area, PERSON.city, PERSON.telephone, CONTRIBUTOR.registration_date, CONTRIBUTOR.fav_category, MUJAHED.profession
FROM PERSON, CONTRIBUTOR, MUJAHED
WHERE (PERSON.id = CONTRIBUTOR.id) AND (CONTRIBUTOR.id = MUJAHED.id);
A tip or guideline on how I can correct this will be appreciated.
Regards
View 1 Replies
View Related
Oct 22, 2013
What I wanted to do was try and import from 5 excel sheets into one table and merge them into 1 record.
E.g. I have pupils with test results for maths, English and ICT.
I have 3 spreadsheets called Maths, English and ICT and I wanted to merge them into the test results table all under that specific pupil.
Also I've been searching how to create an import button on my form as I have locked all the ribbons but can't find a simple way, and especially if I want the user to specify the file path.
View 3 Replies
View Related
Oct 21, 2012
I'm pretty new to making databases outside of a basic access class..Is it possible to make a record in one table that makes a new record in 5 different tables using different bits of the initial record?I want to use the data entered in an evaluation form to create a new entry with the basic identifying information in 4 different tables.
View 12 Replies
View Related
Aug 8, 2013
I am trying to produce a report that shows a single record that has fields in multiple tables. When these reports we're in Word form they were about 7 pages long. I put them in access to be able to update the data in one or more than one of them at a time more effectively. But now I am unable to get them print out one at a time like they looked originally in Word form.
View 1 Replies
View Related
May 7, 2013
I have a tblCustomer table to track customer information. One field is for flights the customer books. I expect that a customer might book more than one flight, which should affect what he owes. (My tblFlights table includes fields for the cost of each flight.) How should I make the Flight field in tblCustomer so it accepts multiple flights and reflects on the customer's final bill and my own accounting tables that I haven't even created, yet?
I'm probably overthinking everything. This is just an Intro to Access class, and I only need 3 tables with 1 relationship. So far, I have 9 primary tables, 4 duplicate tables (for M:N relationships) and 11 relationships. I have to have tables for financial data, customer info and product/service info. I wasn't sure what I would need for my fictional airline, so I created tables to track everything I could think of, hoping to cover all 3 required types of data in the process.
View 2 Replies
View Related
Nov 17, 2014
I currently have a pharmaceutical lot database set up in the following format:
MFGData (table w/Manufacturing Info)
QAData (table w/ Quality Assurance Info)
QCData (table w/ Quality Control Info)
PASData (table w/ Process & Analytical Science Info)
SCData (table w/ Supply Chain Info)
[Code] ....
Each table has a corresponding form for data entry in each area. The tables were subdivided in this way in order to limit each department's ability to edit the data of other departments. The only field common to each table is the drug lot number, or "Lot #" (which is the primary key of each table).
I wanted to make it so that when Manufacturing enters a new lot number on frmMFGData, it automatically creates that lot number in the other 4 tables. This process mirrors our actual real world business process, where drugs are manufactured and assigned new lot numbers by our manufacturing team, and then other departments simply reference those numbers when doing their part.
To accomplish this, I went ahead and set up 1 to 1 relationships between the various tables using their "Lot #" fields, establishing referential integrity and enabling cascading updates. However, when I attempted to enter a new lot number into frmMFGData (the manufacturing form), it didn't seem to appear in any of the other tables. If I edit an existing lot number and change it to something else, the change does carry over to the other tables, so I know that the cascading updates are working in some capacity.
If cascading updates cannot "cascade" new records, then is there any other way to accomplish this?
View 13 Replies
View Related
May 30, 2014
What I have is a database setup with multiple tables in which different areas of my DC can input information simultaneously into their respective tables. I then have another database linked to it for myself to have a live view of each updated record. I would like to see all the records of each table in 1 single table (possibly just sorted ascending by time). Each table has the same Field headings but may have different qtys of records. As I will then have it linked to an Excel table to VLOOKUP from it.
I have tried Union coding but always get Syntax Error etc.
View 8 Replies
View Related
Feb 10, 2015
I'm using the MS Access 2010 ExportwithFormating action to export three tables to a single MS Excel 2010 workbook. The action overwrites the first excel worksheet each time instead of saving all three worksheets in a single excel workbook.
How can I export three tables into a single excel workbook.
View 1 Replies
View Related