Help

R

Ron

I have a form to input information into two different tables. I want to click
on a button and have a field called NC# populated with the autonumber from
table1.

The tables are set up like this.
Table1: Table2:
CAR_ID-Auto Number NCID=Auto Number
CAR#=text CARID=Text
Information=text Information=Text

So now when you click on the buttin it will look at CAR_ID in table1 and
input this into CARID in table2.
 
J

John W. Vinson

I have a form to input information into two different tables. I want to click
on a button and have a field called NC# populated with the autonumber from
table1.

The tables are set up like this.
Table1: Table2:
CAR_ID-Auto Number NCID=Auto Number
CAR#=text CARID=Text
Information=text Information=Text

So now when you click on the buttin it will look at CAR_ID in table1 and
input this into CARID in table2.

Why?

Actually two questions: one, why do you have separate Car_ID and Car# fields,
when presumably either one would uniquely identify the car? (Or would it?)

And why would you want to redundantly store the CAR#/CARID and Information
fields in two separate tables?

Relational databases use the "Grandmother's Pantry Principle": "A place - ONE
place! - for everything, everything in its place". Normally you would have a
single table with information about a vehicle; the automotive industry has
settled on a text ID, NCID, which uniquely identifies vehicles. Could you just
use the NCID as a primary key? It is NOT necessary to use an Autonumber for
this purpose (though Microsoft tries to give that impression!) And once you
have done so, could you not store the informatio *once* and use a query to
look it up as needed?
 
R

Ron

Most of my data is stored in table 1 (CAR Data). some other stata is stored
in table2 (Non-Conformance). I also have other forms that relate in the same
way. So that when you click a button, up pops the NC number, IA number etc.
The two field will store different information but will be similar. for
example, in table1 the CAR_ID is used as a number, the CAR# have information
fromo the different forms. In the field there will be items such as NC-###,
IA-###, QMS-###, etc. This is the reason. Hope this helps you understand the
databse and can help me with the cmd buttom to do what I want.

Thansk,
Ron
 
J

John W. Vinson

Most of my data is stored in table 1 (CAR Data). some other stata is stored
in table2 (Non-Conformance). I also have other forms that relate in the same
way. So that when you click a button, up pops the NC number, IA number etc.
The two field will store different information but will be similar. for
example, in table1 the CAR_ID is used as a number, the CAR# have information
fromo the different forms. In the field there will be items such as NC-###,
IA-###, QMS-###, etc. This is the reason. Hope this helps you understand the
databse and can help me with the cmd buttom to do what I want.

No. It doesn't.

I can think of NO REASON WHATSOEVER to store any two fields about the car
identically in two tables.

You know what a NC number, an IA number, etc. mean. I don't. Would it be a
valid statement to say that one Car can have zero, one, *or more* records in
the Non-Conformance table? If so then you have a perfectly normal "One to
Many" relationship; the Car Data table should have a primary key (which might
be a unique VehicleID or, if you don't have that information, an Autonumber);
the NonConformance table would have its own primary key (perhaps an
autonumber) and a foreign key of the same datatype as the Cars table primary
key (Long Integer if that's an autonumber), as a link to the cars table. You
could use a Subform to fill the data in and have the primary key automatically
fill into the foreign key.

If a given Cars record can never have more than one Non-Conformace record,
then you could very well simply add fields for the nonconformance information
into the Cars table; just leave them NULL if the car is in conformance, and
only fill them in if needed.

There is still NO reason to do what you origianlly suggested: "So now when you
click on the buttin it will look at CAR_ID in table1 and input this into CARID
in table2." Or perhaps I'm still misunderstanding what you are trying to do!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top