PC Review


Reply
Thread Tools Rate Thread

auto populate a field based on value of other fields

 
 
sam
Guest
Posts: n/a
 
      25th Jun 2009

I have a data sheet where I want to auto populate a field (that has specific
values listed in a drop down menu) based on two other fields (both are
dropdown menus with specific values)

For Eg.:
there are 3 fields A, B, C and all these three fields have specific values
which we can select through a drop down menu. Now, Lets say values in the
fields are as follows:

A: 1, 2, 3, 4, 5
B: 1, 2, 3, 4, 5
C: a, b, c

So now, If I select '1' for A and '1' for B then I DONT want any thing to
populate in C and leave it blank.
If I select '1' for A and '2' for B then I want 'a' to be populated in C
If I select '2' for A and '1' for B then I want 'b' to be populated in C
If I select '1' for A and '1' for B then I want 'c' to be populated in C

Basically,
If the value in field A is smaller then field B then I want 'a' to be
populated in C.
If the value in field B is smaller then field A then I want 'b' to be
populated in C.
If the value in field A and B are equal then I want 'c' to be populated in C.

Hope I made it clear enough.

Thanks in Advance.
 
Reply With Quote
 
 
 
 
Steve Schapel
Guest
Posts: n/a
 
      25th Jun 2009

Sam,

In a nutshell... you should remove field C altogether. It is invalid, as it
in breach of database design principles. The reason for this is that when
you know the value of both A and B, the value of C is automatically known,
so it is not correct to store this redundantly in your table.

Instead, this value can be very easily calculated whenever you need it, for
your purposes on form or report. This can be done as a calculated field in
the query that the form or report is based on, or else in the Control Source
of a calculated control on the form or report itself.

--
Steve Schapel, Microsoft Access MVP


"sam" <(E-Mail Removed)> wrote in message
news:0CFD0622-88D4-47A7-A2C8-(E-Mail Removed)...
> I have a data sheet where I want to auto populate a field (that has
> specific
> values listed in a drop down menu) based on two other fields (both are
> dropdown menus with specific values)
>
> For Eg.:
> there are 3 fields A, B, C and all these three fields have specific values
> which we can select through a drop down menu. Now, Lets say values in the
> fields are as follows:
>
> A: 1, 2, 3, 4, 5
> B: 1, 2, 3, 4, 5
> C: a, b, c
>
> So now, If I select '1' for A and '1' for B then I DONT want any thing to
> populate in C and leave it blank.
> If I select '1' for A and '2' for B then I want 'a' to be populated in C
> If I select '2' for A and '1' for B then I want 'b' to be populated in C
> If I select '1' for A and '1' for B then I want 'c' to be populated in C
>
> Basically,
> If the value in field A is smaller then field B then I want 'a' to be
> populated in C.
> If the value in field B is smaller then field A then I want 'b' to be
> populated in C.
> If the value in field A and B are equal then I want 'c' to be populated in
> C.
>
> Hope I made it clear enough.
>




__________ Information from ESET Smart Security, version of virus signature database 4186 (20090624) __________

The message was checked by ESET Smart Security.

http://www.eset.com



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto-populate date field based on two other fields. Dee Microsoft Access 7 17th Feb 2010 07:23 PM
auto populate a field based on other fields sam Microsoft Excel Programming 3 25th Jun 2009 07:12 AM
Auto Populate Fields based on Selection David Microsoft Access 0 30th Nov 2008 11:24 AM
Auto-populate fields based on changing one. Will Microsoft Access Forms 1 1st Aug 2007 12:03 AM
Auto-Populate Based on Other Fields Racer57 Microsoft Access Form Coding 1 18th Mar 2006 03:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:59 PM.