2 forms open simultaneously, with same recordsource (1 Viewer)

neuroman9999

Member
Local time
Yesterday, 18:38
Joined
Aug 17, 2020
Messages
827
do any of you guys do this? I have many times, and never have run into an issue. I am required to do it again, now, but am a little leery to tell the person it's OK cuz they have no clue what they're doing. Is there any trainwreck waiting between doing this and delving into record locking at the form level when having 5 users access the app at once?
 

Ranman256

Well-known member
Local time
Yesterday, 19:38
Joined
Apr 9, 2015
Messages
4,337
I hope you don't have 2 forms on the same record. bad.
you can have 5 users in the db at the same time with a split db and every user has their own front end copy.

there's no reason to have 2 forms open by the same user on the same record either.
 

neuroman9999

Member
Local time
Yesterday, 18:38
Joined
Aug 17, 2020
Messages
827
I hope you don't have 2 forms on the same record. bad.
you can have 5 users in the db at the same time with a split db and every user has their own front end copy.

there's no reason to have 2 forms open by the same user on the same record either.
no, they don't have the same rec open on both forms. one form shows the entire dataset, the 2nd form is over that, filtered, showing one of the recs from the set, for editing purposes.
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 09:38
Joined
Jan 20, 2009
Messages
12,853
Presumably you are opening a single form from a ContinuousForm for the purposes of editing.

Long time since I did this but rather than filtering you can open the second form and use the actual recordset from the first form. The current record will be the same on both and there ins't a clash because you are editing the same instance of the record.

Code:
Me.Form.Recordset = Forms!firstform.Recordset

Refresh the first form when returning the focus to it.
 

neuroman9999

Member
Local time
Yesterday, 18:38
Joined
Aug 17, 2020
Messages
827
That's pretty good advice thanks I'll try it when I get back to working with the employer. By the way, the form underneath is not in continuous view is in datasheet view so considering that will your solution still work? The ID field numbers are in blue and are underlined so when you click on them they currently have code to do exactly what I'm saying it currently does regarding the filtering period
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 09:38
Joined
Jan 20, 2009
Messages
12,853
Should work with any type of form. Your "hyperlink" should just need to open the edit form. You can set the recordset from the same procedure but it is better done form the edit form so it can be a modal form.
 

neuroman9999

Member
Local time
Yesterday, 18:38
Joined
Aug 17, 2020
Messages
827
That's what I thought thanks I was just checking for any unknown dangers that I was unaware of but it doesn't sound like there is any
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 07:38
Joined
May 7, 2009
Messages
19,247
you can just use a Split form for your purpose and set the Datasheet part (No edit).
 

neuroman9999

Member
Local time
Yesterday, 18:38
Joined
Aug 17, 2020
Messages
827
you can just use a Split form for your purpose and set the Datasheet part (No edit).
I would do that, arne, but the employer is set in their ways. it would frustrate them to no end to get them to change. thanks.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 19:38
Joined
Feb 19, 2002
Messages
43,346
I don't use "Access"split forms. If I need a split form, I build it myself with an unbound main form and two bound subforms.

If I use one form to open another, I make the second one model so that the initiating form regains control ONLY when the second form closes. I can then refresh the first for so it will show any updates made by the second form. If the first form is editable (as it might be if you are opening a report), then always save the current record before opening the second form/report.
 

neuroman9999

Member
Local time
Yesterday, 18:38
Joined
Aug 17, 2020
Messages
827
If I use one form to open another, I make the second one model so that the initiating form regains control ONLY when the second form closes.
that is the ONLY way to do this sort of thing, seriously. that controls users who are reckless. it provides security, guidance, stability and least amount of risk. that's why Larry Ellison of Oracle built his product that way.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 18:38
Joined
Feb 28, 2001
Messages
27,218
You asked if there was a pitfall. Yes, if you are careless in setting up the form's record locking, you can get a lock collision which would cause an error event that would require delicate handling. Granted, low probability - but possible. Using either Optimistic locking or No Locks, you would not be likely to see a collision.

Another pitfall: If any 2 of those 5 users try to create a new record at the same time, and in particular if the records are short enough that they COULD possibly occupy the same disk buffer at the same time, that COULD get nasty. Short enough in this context would imply that the entire new record, counting all text fields, is less than 2kbytes in size, which would imply that the two new records would occupy the 1st and last halves of the same disk buffer.

I've seen this in the wild but it IS extremely rare. However, to fail to include this in your list of answers would be improper.
 

neuroman9999

Member
Local time
Yesterday, 18:38
Joined
Aug 17, 2020
Messages
827
Yes, if you are careless in setting up the form's record locking, you can get a lock collision which would cause an error event that would require delicate handling.
I would bet you a million dollars Richard, that if someone who was knowledgeable enough and had enough malice against the developer, wanted to get around record locking and screw with other users in some way, it could be done.
 

Users who are viewing this thread

Top Bottom