A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Automatically populating a field in a table



 
 
Thread Tools Display Modes
  #1  
Old October 27th, 2008, 05:09 PM posted to microsoft.public.access
JudyB
external usenet poster
 
Posts: 46
Default 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  
Old October 27th, 2008, 05:44 PM posted to microsoft.public.access
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default 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  
Old October 27th, 2008, 05:45 PM posted to microsoft.public.access
John W. Vinson
external usenet poster
 
Posts: 18,261
Default 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  
Old October 27th, 2008, 06:04 PM posted to microsoft.public.access
vbasean
external usenet poster
 
Posts: 113
Default 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

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:58 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.