hey there everyone, i need some code to pull data from two tables in Access97.
My situation is this. i have to gather some info about a certain machine and i have info in 2 different tables. i need to be able to pull the data from the 2 tables, update it if need be and then add the new info back to the two tables. i have tried a copule different appraoches to this but have been reletivly unsucessful. thanx for any help.
the tables are related in a field. they share a common machine number that is how i am getting info on a certain machine from each table. my problem is updating each table so that if info for one is changed or updated then the other one needs to be as well. i haven't worked with this stuff very much so can some one tell me about the UNion and Join things? thanx for all the help
i have tried to use the SQL statements and i think that i have them down but i need to know how to put the values that you get from the statements to a VB front end. if you would like i can post code. i did it the way i thought it would be but i got an error. please some one help
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
i have to take some info from both the tables to make a new one, but the new one has to be able to have more than one entry bc it is a table that ensures that a yearly safety test be done on each machine so there will be more than one entry in the resulting table for each machine.
my table structures are as follows
Testble
RNum-PK(Autonumber)
IDNum-FK
NeedACheck
Supervisor
Date
tblMachines
id-PK
machine_name
deptID
NeedsCheck
------------------------------------------------
my sql statments
SELECT Testble.IDNum, tblMachines.machine_desc, tblMachines.NeedsCheck, Testble.NeedACheck, Testble.date tblMachines.deptID, Testble.Supervisor
FROM tblMachines, Testble
WHERE tblMachines.id = Testble.IDNum
that is what i think it would be i had some other SQL statements but i deleted them so i can't give the error.
From personal experience I wouldn't use an inner join, as it only returns records with matching ids. This might sound good, but if you start pulling statistics, it can leads to discrepancies.
I prefer to use the left join, and where clause filtering on not is null if required. At least you know you have everything in the left table with the left join
Of course, for you - it'd be best if you can run both inner and left joins to compare and make the decision yourself.
Also see second top thread, and you other posting on joins (I replied there too)
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
this may sound like a dumb question but......how do you know which is the left and which is the right table? is it the order in which thay appear in your sql statement.
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...