04-11-2006 07:03 AM
04-11-2006 07:14 AM
04-11-2006 09:05 AM
04-12-2006 12:16 AM
well I have a table for a product that contains, say different data for the product, i.e. the date of the test, who is responsible for the test, where it was performed. Also, linked to the date (I guess it is the primary key), there are also some data related. so in my table in the database, next to the date, there is a "+"-sign, so I can open up the page of all the data related to the date.
Well, did you create this database on your own? So you must have created two tables (table one with fields Datum, Responsible & Cost and table two with fields Place1, Place2, Place3 & Place4). Then you must have dragged on field from one table to another field in the other table in the "Relations" view of access. Doing so, you created a relation. Due to this, access now knows how this date is related and displays the "+"-sign. You can not assume that the date is the primary key.In fact you do not have a "2D" table, but just different datasets from two tables connected to each other. This connection is created by relations.
So, if I know would like to create a new table in my program (each product has its own table, so a new product=a new table), I would also like to create this "data" sheet that is connected to the data. Bu how do I do that?I can easily just create a new table (i.e. a new product), just using the "DB Tools Create Table.vi". But I guess it is when I actually want to add the data to the database, where I create the "data" sheet? Using the "DB Tools Execute Query" and a SQL statement with INSERT INTO, is that the way to go?
As mentioned before, this "datasheet" is just a dataset from a second table which is made displayable by the relation. So if you're question is "how to create a relation using LV", you are quite on the right way. First create two tables one of which has to contain a field where the primary key from the other table is linked to. Then you have to set a PK in one table (using SQL statements) and then build the relation (also using SQL statements). I can't tell you, if you have to define the foreign key in the second table too.Have a look at the MS-Access help on how to assign relations and how to define primary keys. There may be something to take care off. Basically standard SQL should do - but using MS you never know ;).
04-12-2006 07:36 AM
You can write to linked tables in Access with no problem. The deal is that you have to write to them separately, (as if they were 2 separate unlinked tables). Obviously, when you do write to the table with the foreign key, you need to include the field which is the key, (date in your case).
04-12-2006 08:18 AM
04-12-2006 08:53 AM
I also don't understand the need to continuously create linked tables in Access. seems to me that you would be better off spending some time designing a more flexible architecture but if that's what you really need, then you add the CONSTRAINT keyword. An example with two tables would be:
CREATE TABLE UUT_RESULT
(
ID COUNTER CONSTRAINT UUT_RESULT_CONSTRAINT PRIMARY KEY,
UUT_SERIAL_NUMBER TEXT,
)
CREATE TABLE STEP_RESULT
(
ID COUNTER CONSTRAINT STEP_RESULT_CONSTRAINT PRIMARY KEY,
UUT_RESULT INTEGER NOT NULL,
CONSTRAINT UUT_RESULT_FK FOREIGN KEY (UUT_RESULT) REFERENCES UUT_RESULT (ID)
)
This would link the table STEP_RESULT to UUT_RESULT by the ID column in UUT_RESULT.
03-12-2019 10:14 PM
Hello everyone,
I want to create a new table in access from an existing one using sql command with labview.
I already have the command that i have to used from "SQL view" in ACCESS. I just want to know how to run that sql code on my existing query using labview. Any help will be appreciated!
Thanks!