Custom forms

  • Thread starter Thread starter Viktor via AccessMonster.com
  • Start date Start date
V

Viktor via AccessMonster.com

Hi all,

I have the following problem.... I have two tables
e.g.
Company
-------------
Cmp_id
CmpName
CmpAddress
and so on

and
People
------------
Ppl_id
PplName
PplLast
PplCmp_id*
and so on...

I want to create a form for entering people... In the form, the user would be
able to enter name, last name... There would be a combo box where the user
could choose the right company for the person he's creating. Obviously, the
user would like to see to company name in the combo box, and not the Cmp_id
number.... How do I do this?

Thanks for your help,
Viktor Kralevski
 
Hi Viktor,

You need to cater for more than one column in your combo box - probably two
will suffice: one for the company id and one for the company name. The
column containing the company id will be the bound column and you may hide it
completely by setting its column width to zero.

The Row Source Type is Table/Query and the Row Source itself will be
something like SELECT CompanyId, CompanyName FROM Company ORDER BY CompanyName

What I suggest you do, when in form design, is to select your combo box and
look at the Format and Data tabs of the Properties dialog. Use F1 to get
context help on Column Count, Column Widths, Column Heads, Bound Column,
Limit To List, etc. The provided Microsoft help is quite extensive.

Regards,

Rod
 
Viktor.
If I understand correctly, you won't need to "select" what company a person works for.
Access will take care of that...

The Main part of the form will be based on the tblCompany (the ONE) and a continuous
Subform will be based on tblPeople (the MANY).

Create a One to Many relationship between tblCompany and tblPeople, with referentail
integrity and cascading updates.
On the form, associate the Main form to the Subform (via the Parent Child property)
using the key field CompanyID.
Now... any time you add a new person to a People subform, the CompanyID will be
automatically forced into the PplCmpID field of the subform record.
Because you enter a person into the sub under a specific company, and because of the
established relationship, Access forces that persons record to have that CompanyID.
 
Thanks guys, I did it with a two column combobox... Acctually, it was the
first thing I did when I started, I just didn't realise the meaning of the
source field :). Thanks again

Viktor
 
Back
Top