How do I join two tables. I have a table and a lookup table. My table has products on there that are listed as custom or basic. I have a look up table that has an ID for basic and Custom. In my table, i want it to read what the id is for each product instead of it reading "basic" or custom. Someone said that I need to join the two tables and do an update query, but I don't understand how to.
And then called this join as a symbol or variable, and then have it use to select the items from these joined tables, can this be done in Access? Here is an example of a code that I created, but it has an error message saying the FROM syntax is incorrect.
Code: SELECT firstJOIN.trainID, firstJOIN.trainName, firstJOIN.stationID, firstJOIN.stationName, firstJOIN.distance_miles, firstJOIN.time_mins FROM (trains INNER JOIN ((station INNER JOIN lineStation ON station.stationID = lineStation.stationID) INNER JOIN bookingLeg ON bookingLeg.startID = station.stationID or bookingLeg.endID = station.stationID ) ON trains.trainID = bookingLeg.tid) as firstJOIN
Can Access do something similar to this, in the FROM statement I joined 4 tables, because each unique fields are in each table and I have to joined them to get those fields. I called this join firstJOIN and in the SELECT statement, I list those columns in the table by calling it firstJOIN.trainID. Can Access do something like this, but syntax it differently?
Okay - the other database is in the works and is going sloooow (the one that is being created with normalization).
Meanwhile, my other database that has no normalization I am having a problem running a query (now I know why its so important to have good structure).
To give you an idea on how bad this is...:o .....
3 tables - 94 fields to each table - each table has identicle fields, just different data. :eek:
Anyways, I have students in each table (each table is an Annual Report). I want to be able to run a simple query and combine all the students into one.
How would I achieve this?
Thank you!
And for all who are thinking about designing a database - READ READ READ and do some more reading on normalization!!!
HELP!!! :confused: I do have a 5 tables 4 tables do have a foreign key of the main table. I join the 4 tables with the main table but when I am editing the information I cannot edit it. and no error appears. so I am just wondering what happen with my joined tables? please help me!!!!Thank you in advance
That is the question: Whether 'tis nobler in the mind to suffer with VBA Programming and the outrageous errors, Or to take up arms against a sea of Access troubles.
Sorry I was in the mood for Shakespeare.
A quick summary first: In the attached file I have my Relationships. One main table, Workorders with various one-to-many relationships back to their respective tables. If you look at the attachment and see a field with 'wrk' that's my foreign key.
What I'm trying to do is this: Where-ever there is a 'wrk' field I want to add in all the fields (minus the ID Primary Key) into the main Workorders Form.
Then on the form itself I should just be able to enter in the data that is required for the fields.
So here's what I'm thinking for the coding is to Join the various tables to thlet me know if I'm on track or not. I'll start with a small one, because if I can get that right, the rest should be simple.
SELECT Model.ComputerID, Make.ComputerID FROM Computer INNER JOIN wrkComputerID ON Model.ComputerID = Make.ComputerID;
there must be a way to do this, but i haven't been able to figure it out yet...
table one has three fields i need to be concerned with, member_ID, range_start, and range_end. no part of any range spanning range_start through range_end will be duplicated.
table two has several fields i need, but the field of primary concern is a person_ID that will fall somewhere within a range designated in the first table.
how in the world can i join these tables, since none of the IDs in the second table are actually listed in the first, but fall in between values?
i need to get member_ID from table one, person_ID and several other fields from table two.
i have 2 tables, A and B A table StockDate Price 02/04/2001 1.12 04/05/2001 1.15 14/08/2002 1.14 18/09/2003 1.26 and so on 1.48 up to 2005
B Table StockDate Price 02/04/2003 1.12 04/05/2003 1.15 14/08/2003 1.14 18/09/2004 1.26 and so on 1.48 up to 2005
i like to know how to write codes to join 2 tables into 1 table like C Table StockDate Price 02/04/2001 1.12 04/05/2001 1.15 14/08/2002 1.14 18/09/2003 1.26 02/04/2003 1.12 --> B Table 04/05/2003 1.15 14/08/2003 1.14 18/09/2004 1.26 and so on 1.48
I work for the school dist. and we have 2 tables for 2 different groups. I need to pull data from them both and create a new Query. Example Table 1: Name, address, phone
Table 2: Name, address, phone
(No similarities in ether database, and we'd like to NOT export data)
I'm hoping it's an easy fix that I've overlooked. Michelle
I have made a form I am trying to bound 3 tables to.
The 3 tables are
tblPersonalInfo tblBookingInfo tblSkills
How I am trying to set it up is that I enter someones personal details in once. But using the same personal details someone can have more then one booking. With the skills....each person can have lots of different skills.
Basically I work for a recruitment agency and I have been asked to build a database that can add new people.add skills to that person.....then add different jobs to the same person.
I have joined all tables togeather (I think wrong but trying) the tblbookinginfo is joined to tblbooking using a 1 - Many relationship using the primary key of tblPersonalInfo to the field PersonalID in the table tblBookingInfo I have joined tblSkills to the table tblbookingID through SkillsID
I created a query using all 3 tables and have used this to bound the form....
The form contains 3 pages and the 1st page works ok (it only contains info from the tblPersonalInfo) the 2 other pages don't seem to work as I want them to.
I would like to be able to click to add a new person and also new booking and new skills
Currently I am able to add new personal details but nothing else.
Have some problems with a Purchase Order (PO) System I'm trying to do.
Figure 1 is the PO entry form. The upper part of the form shows the Header, while the bottom part shows the Line, containing all the ordered item details.
I separated the information keyed in into 2 tables, namely Header table (Figure 2) and Line table (Figure 3). The header table shows only the header details. With the order ID, the header is linked to the Line table where all the ordered items detail can be found.
I want to join the 2 tables and put the data into a new table, which will later be exported to text/spreadsheet for other purposes. I know it can be done using the make-table query. But my concern is about the layout/format of the table.
I would want to put my data where there's one header row followed by the corresponding line rows. Then another new header row with its line rows. I'll give an example:
H XXX XXXXXXXX XX X L XXXXX XXX XX L XXXXX XXX XX L XXXXX XXX XX H XXX XXXXXXXX XX X L XXXXX XXX XX L XXXXX XXX XX L XXXXX XXX XX L XXXXX XXX XX
Note that not all the fields for Header row and Line rows are the same. So can I put different data into the same column?
Would appreciate it if anyone could solve my problems. Thanks. ;)
Hi, I have an unbound form that is based on a query. On the Load-event I have populated textboxes with the underlying records (it works fine).
The underlying query is based on 2 tables that are joined on (PrimaryKey) Table1.ID = Table2.ID (ForeignKey).
The Form has one Add-CmdButton. When the user will click the Add-button the content of the textbox will get added or saved in the underlying database.
I want to know the SQL to add, so that I can write the code behind on the Click-event of the button.
I know on how to add records with a single table (writing code behind), however, I want to know on how to do when it comes with joined tables (INSERT SQL statement ?).
I would like to join two tables with one query. Here is the twist though. The first table would have a set of value like so:
0 50 100 300 500 750 1200 1500
the second table would have values as such
0 1000 1300 1500 1750
by just setting up the relationship to show all values from the sirt table and only those from the second table that match I get a list of values that will not work for me. What I would like to reflect in the query is all the values from the first table and if there is for instance no value of 500 in the second table I would like to return 1000. For instance there is a zero in each table so that would be output twice. There is however no value of 50 in the second table so the query would read 50 and null or blank when I would like it to read 50 and 1000 (The next value higher).
We have a huge Database (relative huge ). Because of that I had to split the database on multiple tables to not lose performance. The main seperation is for every year and Terminal so I have now 6 tables with the same data and structure. Its making maintaining, changes and coding realy hard
At the end of every year we have more than 10 000 records in each table.
The second Problem for joining the tables is that i have to filter them on Terminal (Salzburg, Munchen, Ulm) and on Year (2012, 2013, 2014). The Form I use on that table is a split form (reason is the fast filtering and searching in the datashed).
The first problem with the large amount of records i can solwe with an sql server but there is still the problem with the filtering
I tryed to use the form RecordSource and an SQL statement but in that case (depends how the SQL is struktured and the RecordSource is used) the users cant add or delete records in the table. It shows them that the record is added or deletet but when they leav the form they are all gone
P.S. It's an multiuser database. Making things more complicated
How to solve this second problem with filtering and not disturbing adding and deleting records.
I know that splitforms are not good but the users don't want to use something other that also takes me away the solution with unbound forms
I would like to move to one table until the end of the year. If not I have to handle 9 same tables.
I am trying to join 2 tables with composite keys - each of them have the same 4 columns as part of its key - date/person/problem/date sent.
Table 1 has 5 columns (4 key columns + 1), Table 2 has the same 5 columns plus 1 additional column (Comments).
I am trying to match the Comments column in Table 2 to Table 1 and show the output in another table.
Currently, I've related the 4 columns in each table to each other, each relationship defined as including all records from Table 1 and only the records from Table 2 where the fields are equal.
In the fields, I have 5 Columns from Table 1 and the last column (Comments) from Table 2. When I run the query, I get all the records from Table 1, but not all of the Comments that match from Table 2 are shown.
I want to comine the following queries into one so that I can alter the parameters from a webpage.
I have a users table that has the department in and I have a TimeTable Table which has dates and option codes.
I need to select everybody in a department in the example it's Logistics. I then want to link these people to the timeTable Table based upon a field. The problen is that I want to select only a specific week. I can do this using two queries but that isn't going to work in ASP.
The Results should be as follows:
Person Date Option A B 01/10/2005 1 B 02/10/2005 2 C 01/10/2005 1
The two Queries look as follows:
SELECT TimeTable.* FROM TimeTable WHERE (((TimeTable.Date)>=#10/24/2005# And (TimeTable.Date)<=#10/30/2005#));
The above is then saved as Query1
SELECT Users.*, Query1.*, Query1.TimeOfDay, Query1.Date FROM Query1 RIGHT JOIN Users ON Query1.UserID = Users.ID WHERE (((Users.Department)="Logistics")) ORDER BY Users.Surname, Users.Firstname, Query1.TimeOfDay, Query1.Date;
ContentTypes ---> Site Content Directory Cats ---> Categories Sierra ---> Store Content for Sierra BrushStrokes ---> Store Content for BS
I have "tried" to create a QUERY for the 4 Tables (The code that I have, originally came with 3-Table Query connection I have added in the 4th Table "BrushStrokes")
This is the Query that I created. Before the code, a little insite
At first there was: RIGHT & LEFT JOIN's, But I would receive this: Error 3258 After not really finding any good examples of how to create the 2- Queries and have then work together as one. I decided to try something else, which was to create all [INNER JOIN]'s Which got rid of the Error, and the code still will not work in my site. ======== Microsoft JET Database Engine error '80040e14' Syntax error in JOIN operation. =======
So, here is the code, please let me know what is wrong with it? And if possible, a good example of creating the [2 - Queries] that work as one.
Thank you all Carrzkiss -----------------------SQL QUERY------------------ SELECT Cats.CatID, Sierra.CatID, BrushStrokes.CatID, Sierra.ContentID, BrushStrokes.BSContentID, Sierra.Product_Title, BrushStrokes.BSProduct_Name, Cats.CatDescription, Cats.CatTypeId, Sierra.Product_Th_Image, BrushStrokes.BSThumbnail, Sierra.Our_Price, BrushStrokes.BSPrice, Sierra.Retail_Price, BrushStrokes.BSRetail, Sierra.Aff_Name, BrushStrokes.Aff_Name, Sierra.Brand_Name, BrushStrokes.BSArtistName, Sierra.YAvailable, BrushStrokes.BSStatus, Sierra.Percent_Savings, Sierra.Unique_Product_ID, BrushStrokes.BSProductID, Sierra.Main_Cat, BrushStrokes.BSCol_Cat, ContentTypes.ContentType, Sierra.Product_Description, BrushStrokes.BSDescription FROM ((ContentTypes INNER JOIN Sierra ON ContentTypes.ContentTypeID = Sierra.ContentTypeID) INNER JOIN BrushStrokes ON ContentTypes.ContentTypeID = BrushStrokes.ContentTypeID) INNER JOIN Cats ON (BrushStrokes.CatID = Cats.CatID) AND (Sierra.CatID = Cats.CatID) WHERE (((Sierra.Display)=1) AND ((BrushStrokes.Display)=1)); -----------------------------END SQL QUERY------------------
Thanks for all help so far, this forum is great ;)
I have 3 tables: Order, Product and Names.
I want to list All orders, no matter if they hold a key to a product or not, and no matter if this product has been given a name (in the table name) or not.
To make it even more complicated, the customer can give upp to 16 namesuggestions, they are all numbered from 1-16. But If they are given a namesuggestion, i only want to present the first one (nr 1).
Relations: 1 order -> 0 or 1 product. 1 order -> 0 or up to 16 names, of which i only want to display nr 1.
Any suggestions? I am thinking of preparing the data in a temporary table, but would be glad if i did not need to do so....
Got the following question. I have got two tables with the following values
Table X with Field ULX: XAUUSD XAGUSD CAD AAD
Table Y with Field ULY AUDUSD XPT XAU XAG XAUUSD XAGUSD
Now I want to select the values from table X that correspond witht the values in Table Y for which I use the INNER JOIN operation, wich is working and gives me the results I am looking for.
But now I want to select the values from Table Y that do NOT correspond with the values in Table X, when I rewrite the INNER JOIN operation but now with the <> operator, my results still show the values XAUUSD and XAGUSD from table X.
This is my query:
Select distinct Y.ULY from Y Inner join X on Y.ULY <> X.ULX ;
I inhereted a database, and i know nothing about access. I'm trying to add a new payment record and I get this error: cannot add record(s); join key of table 'tblPayments' not in record set. I have never created or updated access before.