P
Paulo Ferreira
Hello,
Can someone tell me how to open a form in exlusive mode.
Many thanks.
Paulo Ferreira
Can someone tell me how to open a form in exlusive mode.
Many thanks.
Paulo Ferreira
Klatuu said:I have never done this. I would be cautious about doing so, because it
could
get messed up so that neither user could open the form. However, my
first
idea would be to create a table with one record and one field. Then use
the
Open event of the form to check to see if the form is open by someone else
before allowing the form to continue opening.
Dim rst As Recordset
Set rst = Currentdb.OpenRecordset("TableName")
If rst![InUse] = "Yes" Then
MsgBox "This Form Is not Available"
Cancel = True
Else
rst.Edit
rst![InUse] = "Yes"
End If
rst.Close
Set rst = Nothing
And in the Close event of the form:
Currentdb.Execute("UPDATE MyTable SET InUse = 'No';"), dbFailOnError
Paulo Ferreira said:As the form is used for two persons to add records, I would like to limit
the access to that form to one at a time.
Thanks
Paulo Ferreira said:Now, it stops on line "If rst![InUse] = "Yes" Then" with "runtime error
3021".
More help please.
Thanks.
Paulo Ferreira
Klatuu said:I have never done this. I would be cautious about doing so, because it
could
get messed up so that neither user could open the form. However, my
first
idea would be to create a table with one record and one field. Then use
the
Open event of the form to check to see if the form is open by someone else
before allowing the form to continue opening.
Dim rst As Recordset
Set rst = Currentdb.OpenRecordset("TableName")
If rst![InUse] = "Yes" Then
MsgBox "This Form Is not Available"
Cancel = True
Else
rst.Edit
rst![InUse] = "Yes"
End If
rst.Close
Set rst = Nothing
And in the Close event of the form:
Currentdb.Execute("UPDATE MyTable SET InUse = 'No';"), dbFailOnError
Paulo Ferreira said:As the form is used for two persons to add records, I would like to limit
the access to that form to one at a time.
Thanks
"Klatuu" <[email protected]> escreveu na mensagem
What do you mean by exclusive mode? Allow no other user to open an
instance
of the form? Allow no other user access to the data that provides the
form's
recordset?
But, more curiously, what is the purpose of doing this?
:
Hello,
Can someone tell me how to open a form in exlusive mode.
Many thanks.
Paulo Ferreira