Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / September 2005

Tip: Looking for answers? Try searching our database.

ID number getting overwritten

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Elena Kuo - 22 Sep 2005 01:35 GMT
I have two tables a main table and another we'll call Table 2.  I joined them
so it says "all records from main table and only records from Table 2 when
they are equal, and matched by ID.  There are no records yet in Table 2.  
When I make a query or form and go to add information into Table 2, it
overwrites the ID from the maintable with a 0, instead of starting a record
with the ID From the main table as it's ID number.  

I have set up these tables before but my expertise is very minimal so I
could have easily set it up correctly by mistake previous times...  the only
difference I can see between my other databases and this is that the join
type says one to one on the bad one and it says one to many on the working
database.  But I can;'t figure out how to set it to be a 1 to many join.
Allen Browne - 22 Sep 2005 04:40 GMT
Open Table2 in design view.
Select the foreign key field (the one that you match to Table 1.)
In the lower pane, remove the zero from the field's Default Value.

While you are there, consider setting the Required property for this field
to Yes, so you don't get orphaned records in Table 2 (i.e. records where the
foreign key is null.)

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>I have two tables a main table and another we'll call Table 2.  I joined
>them
[quoted text clipped - 11 lines]
> type says one to one on the bad one and it says one to many on the working
> database.  But I can;'t figure out how to set it to be a 1 to many join.
John Vinson - 22 Sep 2005 04:49 GMT
>I have two tables a main table and another we'll call Table 2.  I joined them
>so it says "all records from main table and only records from Table 2 when
>they are equal, and matched by ID.  There are no records yet in Table 2.  
>When I make a query or form and go to add information into Table 2, it
>overwrites the ID from the maintable with a 0, instead of starting a record
>with the ID From the main table as it's ID number.  

It's probably just that you have the ID from the main table bound to
the Form, rather than the child table. I would suggest a different
approach: rather than a Query joining the two tables, use a Form based
on Table1 with a Subform based on Table2. Make ID the Master Link
Field and Child Link Field; this will let you enter multiple records
in Table2 for each record in Table1, and keep the two ID's in synch.

                 John W. Vinson[MVP]    
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.