lock records after update query

P

p-rat

I have a system that has three tables Header, Payroll, Invoice. The
main data entry form can also be opened in Edit mode for changes. This
form is a 'ticket'. Our 'jobs' can be made up of 20-100 tickets. We
want to now be able to push this data into another system through an
import/export process; one job at a time. Once we verify the
information is good and we export, I want this process to push a
timestamp into a column in my Header table 'closed_date'.

So, I think I will need an update query to search for ALL the tickets
that are involved in the Job to be exported and then place the
timestamp in the 'closed_date' column. I also want, though, to LOCK
all the records that make up the tickets on the job from further
editing. How is this done.

The main entry form has to continuous sub-forms on it. Will I have to
place some code in each form or will placing code in the main form
work?

Not sure what the code will be, but am trying to guidance to see if
I'm going down the right path or not. Also what even would I place the
code in? Thanks for any help anyone can provide.
 
P

PieterLinden via AccessMonster.com

p-rat said:
I have a system that has three tables Header, Payroll, Invoice. The
main data entry form can also be opened in Edit mode for changes. This
form is a 'ticket'. Our 'jobs' can be made up of 20-100 tickets. We
want to now be able to push this data into another system through an
import/export process; one job at a time. Once we verify the
information is good and we export, I want this process to push a
timestamp into a column in my Header table 'closed_date'.

So, I think I will need an update query to search for ALL the tickets
that are involved in the Job to be exported and then place the
timestamp in the 'closed_date' column. I also want, though, to LOCK
all the records that make up the tickets on the job from further
editing. How is this done.

The main entry form has to continuous sub-forms on it. Will I have to
place some code in each form or will placing code in the main form
work?

Not sure what the code will be, but am trying to guidance to see if
I'm going down the right path or not. Also what even would I place the
code in? Thanks for any help anyone can provide.

In a nutshell, you would set the AllowEdits etc properties of the form in the
Current event.

The On Current event fires every time you go to a different record *in your
form*. (Tables do not raise events you can trap in code, so if you go
directly, you'll get into trouble.) The easiest way to do this is something
like

Private Sub Form_Current()
Me.AllowEdits = Not (Me.Controls("Closed_Date") Is Null)
End Sub

If you need to set the AllowEdits property of the subform(s), you can do it
basically the same way, but the syntax can get fun... you might want to read
this article:
http://www.mvps.org/access/forms/frm0031.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top