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 / General 2 / July 2008

Tip: Looking for answers? Try searching our database.

How to autofill in a table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
GGD - 17 Jul 2008 08:49 GMT
For example, there are some fields in a  Human Resources table, like 'name',
'sex', 'age' and so on. Now I input a person's name in the salary table
which also contains 'name', 'sex' and 'age' fields. I want Access autofill
his/her sex, age information when I input his/her name, how can I do?   By
the way, I use Access2003.
Thanks!
Allen Browne - 17 Jul 2008 09:29 GMT
Suggestions:

1. Storing age
Don't have an Age field!  Instead, use a BirthDate (Date/Time) or BirthYear
(Number) field. The age changes all the time, so if you have a few hundred
people, storing the age means your stored data is wrong again almost every
day. You can calculate the age as needed from the birth data. Post a reply
if you need more details of that.

2. Storing gender
If you have a Title field (entries such as Mr/Ms/Dr/Prof/Rev/...), you can
use the AfterUpdate event procedure of this control on your form to have a
guess at the gender and assign a value to your Sex field. This only works
for some titles though.

If you want to do it by looking at the person's name, you would need to
teach it how. That would mean creating a table of common first names, with
the most likely gender to guess. Again, this only works with some names.

3. Name field
Hopefully you don't really have a field called Name. Almost everything in
Access has a Name property, so Access will misunderstand it, e.g. thinking
you are talking about the name of the form instead of the contents of the
text box called Name.

In any case, you really need to break the name down into its parts, which
makes it much more efficient for searching and sorting. Using separate
fields for Surname and FirstName would be minimal.

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.

> For example, there are some fields in a  Human Resources table, like
> 'name', 'sex', 'age' and so on. Now I input a person's name in the salary
> table which also contains 'name', 'sex' and 'age' fields. I want Access
> autofill his/her sex, age information when I input his/her name, how can I
> do?   By the way, I use Access2003.
> Thanks!
GGD - 17 Jul 2008 11:45 GMT
Thanks very much for your help!

I means, the human resources tables have already contained all the data of
everyone, including his/her name, gender, birthday and so on. These records
are already there.
And now, I want Access autofill someone's gender, birthday when I input
his/her name in another table ( this table also contains gender, birthday
... fields ).  Can it autofill these fields associated the person by his/her
name?  Suppose there are no same names in HR tables.
Thanks again!
Allen Browne - 17 Jul 2008 13:19 GMT
So you already have a Staff table with one record per person and a StaffID
primary key, and you are now creating a Salary table so that one staff
member can have multiple salary entries over time.

The Salary table will have a StaffID field that relates to the Staff table's
StaffID. The Salary table should not have any of the other fields from the
Staff table - not the name, age, etc.

Instead you can create a query that joins the 2 tables. In the query output,
include all the fields from the Salary table, and the ones you need to see
from the Staff table. This enables you to see any of the staff fields you
want, without duplicating them in the Salary table.

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.

> Thanks very much for your help!
>
[quoted text clipped - 6 lines]
> his/her name?  Suppose there are no same names in HR tables.
> Thanks again!
Douglas J. Steele - 17 Jul 2008 11:50 GMT
In addition to Allen's spot-on advice, be aware that you shouldn't store the
sex, name and age fields in the Salary table. All that should be there is a
foreign key pointing to the appropriate entry in the Person table. Create a
query that joins the two tables when you need the additional information.

Access is a relational database system: use it relationally!

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> Suggestions:
>
[quoted text clipped - 31 lines]
>> I do?   By the way, I use Access2003.
>> Thanks!
GGD - 18 Jul 2008 12:30 GMT
Thanks all !
Karl Heinz-Pape - 19 Jul 2008 19:27 GMT
arschloch
> Thanks all !
 
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.