Access Default Value from Other Field

Associate
Joined
18 Jul 2007
Posts
476
Location
England, Berkshire
Hello,

In access I want it so when someone enters a value in column1 the default value in column2 is automatically populated

Column1 Column2 (Default value)
A-----------1
B-----------2
C-----------3

A = 1
B = 2
C = 3

How and where would I express this?
 
How are you populating data? Directly in the table, via a form, via SQL statements?

Ideally you do not want to store this data anywhere but the table which defines what these values are, this gives you flexibility shoudl you ever want to change the values without needing to run whole updates on tables. Create a new table defaultValues (for example) then join your column 1 entries on this when you report/output the data.

If you are designing in Access then just create the tables and join Column 1 in your Data table to Column 1 in the defaultValue table and when you report it will JOIN as required.



Edit - Nevermind the below, totally missed the 'Access' part :D

Excel I assume?

VLOOKUP

So in Column 2:

=VLOOKUP(A2,$D$2:$E$6,2)

This will look for the entry in Cell A2 in a table of 2 columns (D2 to E6, the $ signs dictate that these values should NEVER change when you copy the forumla into other cells with, for example, the drag handle) and return the result from column 2 of that table.

The Table would contain the data to search on in Column D and the returned results in Column E.

vlookupocuk.JPG
 
Last edited:
Hello,

Using Microsoft Office 2010

I am working on one table.

Basically if someone selects a combo value in say column1 then the next column along column2 is automatically filled with a value corresponding to the value selected.

I dont want to involve excel as i know you can do this in access somehow.

Now the only ways i can think of doing this is through an expression in the default value property.

If [column1] = "A" then 1 If "B" then 2 or If "C" then 3

if that makes sense...
 
Combo value? This is form based entry then?

It still does not make any sense to do it this way really. Is there any reason why you can not run more than 1 table and use a relationship model to do it 'right' ?
 
Back
Top Bottom