Multiple Forms accessing same record

H

Howard

Hi!
I have a main form with three sub forms. They are all bound to the same
query. Basically, each form is displaying a portion of the fields within the
same record. The reason I did it as separate forms is that I wanted to be
able to disable groups of fields depending on a status.

The problem is that sometimes I get an error messag that I cannot save the
record as it will create duplicate index entries. I think what is happening
is that each sub-form is openning it's own record and they are conflicting
with one another. Any thoughts? Any help will be appreciated.
 
M

Marshall Barton

Howard said:
I have a main form with three sub forms. They are all bound to the same
query. Basically, each form is displaying a portion of the fields within the
same record. The reason I did it as separate forms is that I wanted to be
able to disable groups of fields depending on a status.

The problem is that sometimes I get an error messag that I cannot save the
record as it will create duplicate index entries. I think what is happening
is that each sub-form is openning it's own record and they are conflicting
with one another.


You're right. This arrangement is the same as multiple
users edititng the same recaord at the same time.

Instead of using multiple subforms, how about using a tab
control. You can make a tab page invisible or disabled to
accomplish your main goal.

If, for some reason, that doesn't fit into you scheme, I
would suggest setting a group of controls Tag property to
something like Group1, Group2, etc. Then you can use a
procedure like this to enable/disable a group:

Sub MyGroup(grp As String, OnOff As Boolean)
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Tag = "Group" & grp Then
ctl.Enabled = OnOff
End If
Next ctl
 
H

Howard

Thanks Marshal,
The tab pages won't work for me, but I'll try the tab grouping approach.
Otherwise, I'll see if I can leave it as one big form, use some boxes to make
appear as if it's broken into sections, and disable a whole group of fields
at a time. Thanks for the help!

-Howard
 

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