Re: Exclusive Form

Tech-Archive recommends: Fix windows errors by optimizing your registry



"tboggs" <tboggs@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:73930843-A38B-4FF3-819C-EC08DD056A23@xxxxxxxxxxxxxxxx
That didn't seem to work. The second person can still open the form. I
suspect this is because the first person hasn't saved the record yet and
Access isn't picking up that the record needs to be locked?

What I would really like, is for a popup to tell the 2nd person to open
the
form that someone is already in the form and that they must wait for them
to
finish before opening. I would also like the form to automatically close
on
the 2nd person so no information can be inputted.

Thanks again for any help that can be provided!!

- Travis

"Stuart McCall" wrote:

"tboggs" <tboggs@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1B8077FA-BC13-4E68-88F0-077A693B5DBA@xxxxxxxxxxxxxxxx
Is there a way to set one form to be exclusive? The form that I want
to
be
exclusive automatically posts a number that is required and if two
people
enter before hitting the save button, then the second person has to
retype
all of the information.

I have a fairly good knowledge of programming, but I'm not sure how to
accomplish this in Access.

Any help would be greatly appreciated!

- Travis

Set the form's 'Record Locks' property to 'Edited Record'. Should do
exactly
what you want.

Well Access doesn't work that way 'out of the box', so you need to roll your
own system to do this.

I suggest a new table with 1 field:

FormName Text 50

In the form's OnOpen event, put:

If Dcount("FormName", FormTable", Me.Name) > 0 Then
'Tell user no go till the form is free again
Exit Sub
End If
CurrentDb.Execute "Insert Into FormTable Set FormName = '" & Me.Name & "'",
dbFailOnError

(that should be all one line)

In the Form's OnClose event, put:

CurrentDb.Execute "Delete From FormTable Where FormName = '" & Me.Name &
"'", dbFailOnError


Note that this technique 'locks' the form, not the record. That seems to be
what you're asking for.


.


Quantcast