473,471 Members | 1,970 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How do I make one field value determine value of second field in form?

10 New Member
In my database, I have a table that has a list of procedure codes as one field and a cost assigned to each procedure as a second field.

I have a second table where I enter one of the procedure codes (looked-up from my original table/typed in), and I would like the value associated with this code in the original table to auto-populate a second field "after update".

Is there a way to make this field pull from the same table as the procedure code is pulling rather than having to type hundreds of "If/Then" statements in VBA?
Jul 19 '12 #1

✓ answered by zmbd

jcrist30:

I would normally do this in a query.
As given in your first table, hopefully, the procedure codes are your primary key. These codes are then a foreign key in the second table and you would establish a one to many relationship between the tables on the common field... no need to have the same data in two tables as you are working in a relational database.

You would then use the tables in queries to do your data pulls and other calculations. I also create my lookup controls at the query and form level.

I must ask, due to the nature of your question, about your experience level with Access? Starting out, done some work etc...

Respectfully, I ask that you take a read thru the following:
Database Normalisation and Table Structures. This article does a fairly good job explaining the normalization concepts - which for many, is a difficult thing to master.... I know, been there once a long time ago myself.

This website has a great basic tutorial on RDMS design... you're not going to design a hospital admin application with this site... well, maybe you can... the steps would be basically the same: A Tutorial for Access

Of particular note is tables page within the tutorial - notice the information that is given, the table name, the field name, the field type, key or index, etc... AND the format used to present that data. When you post back, this is the type of information we'll need to help you along in your project. You don't need a fancy gridded table to do this... just a line by line layout.

As for lookup fields in tables... I avoid lookup fields at the table level! :Are Lookup Fields in Tables Evil? ... despite the fact that these are supported in MSAccess, they are not supported in other databases should you need to upgrade and writing queries later on will be somewhat problematic. IMHO: The ONLY exception I've seen for this deals with a share-point integration.
There will be other people that argue that these are just fine at the table level... I side with with the MVPs that do this stuff for a living.

-z

2 20940
zmbd
5,501 Recognized Expert Moderator Expert
jcrist30:

I would normally do this in a query.
As given in your first table, hopefully, the procedure codes are your primary key. These codes are then a foreign key in the second table and you would establish a one to many relationship between the tables on the common field... no need to have the same data in two tables as you are working in a relational database.

You would then use the tables in queries to do your data pulls and other calculations. I also create my lookup controls at the query and form level.

I must ask, due to the nature of your question, about your experience level with Access? Starting out, done some work etc...

Respectfully, I ask that you take a read thru the following:
Database Normalisation and Table Structures. This article does a fairly good job explaining the normalization concepts - which for many, is a difficult thing to master.... I know, been there once a long time ago myself.

This website has a great basic tutorial on RDMS design... you're not going to design a hospital admin application with this site... well, maybe you can... the steps would be basically the same: A Tutorial for Access

Of particular note is tables page within the tutorial - notice the information that is given, the table name, the field name, the field type, key or index, etc... AND the format used to present that data. When you post back, this is the type of information we'll need to help you along in your project. You don't need a fancy gridded table to do this... just a line by line layout.

As for lookup fields in tables... I avoid lookup fields at the table level! :Are Lookup Fields in Tables Evil? ... despite the fact that these are supported in MSAccess, they are not supported in other databases should you need to upgrade and writing queries later on will be somewhat problematic. IMHO: The ONLY exception I've seen for this deals with a share-point integration.
There will be other people that argue that these are just fine at the table level... I side with with the MVPs that do this stuff for a living.

-z
Jul 20 '12 #2
lyodmichael
75 New Member
the secret of your problem is in the query .
Jul 20 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: lawrence | last post by:
Is there an easy way to sort a 2 dimensional array alphabetically by the second field in each row? Also, when I use sort() on a two dimensional array, it seems to work a lot like...
1
by: efiedler | last post by:
Hi - I have the following input field on my html page: <input type="image" name="submit" id="submit" src="c:\image.jpg" value="image.jpg"> I also have another input field on the form that is...
1
by: Jim | last post by:
I have a 2 checkboxes and a hidden field..what I want to happen is that you can only click on 1 of these checkboxes at a time and when you check a checkbox it will assign the hidden field...
2
by: Big Time | last post by:
Hi, I have a question regarding using drop down lists and how to get them to limit the list of a subsequent field. I have a database which has the names of colleges. Each college has it's own...
2
by: MLH | last post by:
Fields in MyTable: PostID PostDate RollQtyXfer RollDenomination RollCount37 RollCount23
5
by: james.calhoun | last post by:
I feel like this should be really easy... I want a hidden field in a form to have its value defined when someone clicks on a link. So if they click on link "A" the value of the hidden field...
4
by: Mangler | last post by:
Without writing a bible on what I'm trying to do I'll see if someone can answer a quick question. I have a form that the user writes a value in a test field. I need to put a hidden value that...
34
by: valley | last post by:
Hello, I am new to access. I need to have the Default value in a field for a record as the SUM of all the values in another field where the value of a thirdr field is same. All fields have numeric...
1
by: sillyr | last post by:
Hi I wanted to make a statement in a form to take a value from one field if the first field has no value. I have a form created from two tables. Each table has a field called Haul number. On the...
4
by: Michael Munch | last post by:
Hi I want to read the value of af text-field, create dynamic, in a form. Se below a small test-site to do that (but readning fails): I use the function Test_Read for reading the value from the...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.