Limit subform to 1 entry

G

Guest

Hello,

I have create a basic contact db. In which I created a main contact form
which house the contacts personal information. Then I create a subform which
houses the information pertaining to the business (company name,
address,...). I set everything up and all is working fine. However, my
issue is the fact that if the user tabs through the controls on the subform
he will get place on a 2nd, 3rd,... record. I only want one entry possible
per contact. How can I do this?

Thank you for the guidance,

Daniel P
 
A

Al Campagna

Daniel,
Your design is going about this backwards.
The proper relationship should not be One Contact to Many Companies. It should One
Company to Many Contacts.
The Main form should be the Company (The One), and the subform the multiple contacts
(The Many)
--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 
G

Guest

My design is correct

company (1) to Contacts (many)

The issue is that i need to display the info base on the contacts rather
than by compnay. Thus the company is in a subform linked by CompID. So
every contact record pulls the appropriate Company Info in the subform.

Any advice?

Daniel P
 
A

Al Campagna

Daniel,
From what you've indicated so far, on this particular form, it's really One Contact to
One Company (Company sub can only have one entry, and the Main form contains only one
Contact) While you certainly can have this type of form, it's not usually used for
"Company" data entry
I would still think that the way the Company and Contact data gets entered would be
going to a Company record, and adding a name to the Contact list. Or, creating a new
Company record, and listing the associated contact/s.
That would allow you to simply set the subform AllowAdds = No on this form.

But... using your method, you'll have to code up to determine if there is a Company
record existing against a particular contact. You could trigger it through the Main form
OnCurrent. For this ContactID, if DLookup Company IsNull, set the sub's Allow Adds =
Yes. If not, AllowAdds = Yes (AllowEdits could be on in either case).
And, you'll also need essentially the same code in the Company subform. After one
Comapny has been entered, further records can not be added.

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."
 

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