Full Version: Create A Record When A Field Is Changed
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
dhapp
Two tables

tblBlueFlags
BlueFlagID AN PK
JobID Number (Long)
JobType1 Number
JobType2 Number
BlueFlagDate Date

tblJobs
JobID AN PK
IniDate Date
JobType Number (Long)
DepartmentID Number (Long)
Other fields...

frmJobs is used to populate the tblJObs.
A combo box (cbxJobType) is used to populate the field JobType with a value from the JobTypes table.

Here's what I want to do:
If the user uses frmJobs to change a JobType I want to create a record in tblBlueFlags table that holds the new JobType in JobType2 and the previous JobType in JobType1.

Example:
JobID: 706
IniDate: 2/15/2012
JobType: 4
Department: 3

User opens frmJobs and changes the the JobType of JobID 706 from 4 to 6.
This needs to trigger a record in tblBlueFlags
JobID: 706
JobType1: 4
JobType2: 6
BlueFlagDate: 5/23/2012

I know how to write the SQL string for inserting the record into the table I am not sure how to get the pre-update value of JobType.
theDBguy
Hi Doug,

What version of Access are you using? Please remember to select the version number when posting questions in case it becomes relevant to the discussion.

Take a look at the OldValue property in Access Help Topics.

Just my 2 cents... 2cents.gif
dhapp
Thanks. that was what I needed.

btw - I thought I did put the version - oops sorry. (Access 2007)
theDBguy
Hi Doug,

yw.gif

For future reference, if you "preview" your post before submitting it, you will have to select it again, or it will not show up.

Good luck with your project.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.