Prev: Backup button
Next: meus caminhos
From: CW on 25 Feb 2010 09:21 Jeff - That's very helpful, just what I needed to know Many thanks CW "Jeff Boyce" wrote: > You can use, as a primary key, a value entered automatically by the > database. It has different names in different databases, but there's no > need to have the user enter the [Company] primary key value ... unless you > have some way of ensuring that two companies can't have the same companyID, > in which case your user COULD enter the key. > > If your [Contacts] table (I assume you mean [CompanyContact]) has, as a > foreign key, a field that points back to the [Company] record that "owns" > it, you can use a main form/subform construction. Your main form would be > the [Company] form, and the subform would show the [CompanyContact] table > records that are related. You tell Access which fields to use as the > 'parent' and 'child' fields, and Access handles putting the CompanyID into > the [CompanyContact] record ... automatically! > > Good luck > > Regards > > Jeff Boyce > Microsoft Access MVP > > -- > Disclaimer: This author may have received products and services mentioned > in this post. Mention and/or description of a product or service herein > does not constitute endorsement thereof. > > Any code or pseudocode included in this post is offered "as is", with no > guarantee as to suitability. > > You can thank the FTC of the USA for making this disclaimer > possible/necessary. > > "CW" <CW(a)discussions.microsoft.com> wrote in message > news:0C38626F-11E8-485B-B075-ADB3C55E5718(a)microsoft.com... > > I'm setting up a database of corporate customers, which will include our > > contact persons at each of them. In some cases there are several contacts > > at > > a company, with different roles. > > I will create one table for the Companies and another for the Contacts and > > then a subform for displaying these at the bottom of the main company > > form. > > Presumably this is a classic one-to-many relationship and I will need a > > primary key in the tblCompanies table (e.g. Company1) and then a similar > > entry in the tblContacts table, for the link to be made. > > Question - how does the key get entered into tblContacts? If there is a > > relationship between the fields, will the relevant value (such as > > Company1) > > be automatically passed into tblContacts when a new Contact record is > > created, because that is how the main form and subform are linked ? Or > > does > > the user have to input it manually? > > Thanks > > CW > > > . > |