Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Locking problems

Status
Not open for further replies.

chirpyform

Programmer
Jun 20, 2003
202
FR
I have a chain of 3 forms:

Form1 deals with table1 in read-only mode. We double click in a record to see the details in form2.
In Form2 we are in mode modify. We click a button in form2 to goto form3 which is linked to table2 which is in relation with table1.

The problem is that I want to stop the user going to form three if there is already somebody (using another computer but the same database) using the same record in form2.
I can lock the form2 from being changed by 2 users at once but I don't know how to stop the 2 users from going to form3 (You will just have to take my word for it that this causes a problem).

Is there a way of testing if the form is in locked for example.

eg
If form is in a state of being locked ie someone else is in the form then
form.button.enabled = false


Chris
 
I have locked the current record for the form2 and when I click the button I try to change the value and if there is a second user I have an error. So I don't allow the form3 to open if I have an error eg

On Error GoTo Err_Form_Load
Me.SpecVerrou.SetFocus
If Me.TestValue = 0 Then
Me.TestValue = -1
Else
Me.TestValue = 0
End If
docmd.openform "form3"

Exit_button_click:
Exit Sub
Err_button_click:
msgBox "Another user ..."

So if I can't change the value of TestValue then I will not open the form.

The problem is that if the user has not changed anything in the form then the form doesn't lock itself from the other users. Ie both users can go into the form and click the button. WHY?

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top