If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Automatically populating a field in a table
I have a table titled "Job Codes" with 3 fields - 1) JobTitleID, 2) LOP, and
3)JobTitleName. I would like to tie the LOP field and the JobTitleName fields together. In other words, when I select a JobTitleName on my form, I would like for it to automatically enter the LOP that corresponds with that title. Is this possible? Thanks! -- JudyB |
#2
|
|||
|
|||
Automatically populating a field in a table
Why the LOP and not the [JobTitleID]? "Automatically enter the LOP" ...
?where? If you use a combobox on your form, you can "see" the [JobTitleName] displayed, even though your table is storing the [JobTitleID]. Regards Jeff Boyce Microsoft Office/Access MVP "JudyB" wrote in message ... I have a table titled "Job Codes" with 3 fields - 1) JobTitleID, 2) LOP, and 3)JobTitleName. I would like to tie the LOP field and the JobTitleName fields together. In other words, when I select a JobTitleName on my form, I would like for it to automatically enter the LOP that corresponds with that title. Is this possible? Thanks! -- JudyB |
#3
|
|||
|
|||
Automatically populating a field in a table
On Mon, 27 Oct 2008 10:09:01 -0700, JudyB
wrote: I have a table titled "Job Codes" with 3 fields - 1) JobTitleID, 2) LOP, and 3)JobTitleName. I would like to tie the LOP field and the JobTitleName fields together. In other words, when I select a JobTitleName on my form, I would like for it to automatically enter the LOP that corresponds with that title. Is this possible? Thanks! Possible? Yes. A good idea? ABSOLUTELY NOT. You're using a relational database - use it relationally! If a LOP code implies a specific JobTitleName, then you should have a LOP table with one record for each JobTitleName; you would store only one of these fields in your Job Codes table, and then use a Query joining it to the LOP table to look up the other one. -- John W. Vinson [MVP] |
#4
|
|||
|
|||
Automatically populating a field in a table
you can use the 'After_Update' event of whichever control you use for
JobTitleName to insert the value into your form. is LOP 'point in time' data? Meaning, is LOP a value that changes over time for each job? Like a price of a product, you have a table with products and current price and when you add them to an invoice that is the price at time of sale. That is 'point in time' data. It is something to want to record. If it's not, then you don't want to record it, you just want to retreave it. If that's the case then you just create a query with the two tables containing the information and then just add that field to your form. When you set the value in 'JobTitleName' the other value shows up. If it is 'time in point' then you want to 'copy' the data from one table to the other. This code is added to a combo box named 'JobTitleName' in the 'AfterUpdate' event. Private Sub JobTitleName_AfterUpdate() Me.LOP = DLookup("[Job Codes]", "[LOP]", "[JobTitleName] = '" & Me.JobTitleName & "'") End Sub -- ~Your Friend Chris http://myvbastuff.blogspot.com/ thinking out loud "JudyB" wrote: I have a table titled "Job Codes" with 3 fields - 1) JobTitleID, 2) LOP, and 3)JobTitleName. I would like to tie the LOP field and the JobTitleName fields together. In other words, when I select a JobTitleName on my form, I would like for it to automatically enter the LOP that corresponds with that title. Is this possible? Thanks! -- JudyB |
Thread Tools | |
Display Modes | |
|
|