S
swas
Hi,
I have a main form with a treeview control, and several subforms on a tab
control. Depending on the treeview node determines the recordsource for the
appropriate subform, and whether it is editable or not. I am controlling the
recordsource to restrict the recordset to a single record to keep network
traffic to a minimum. All this is working fine.
When I want to add a new record, I want to allow this only when a certain
tree level is selected for a given subform, which detecting and controlling
this is fine also. My problem is how to manage the subform fields for a new
record. If I set it to a new record automatically when the appropriate tree
node is selected it means new records can inadvertantly be added without
realising. Because it is a bound form I can't just set the recordsource to
nothing until an 'add' button is pressed as all bound fields show '#Name'
which looks bad. If it is a new record I can't set 'allowedits' to false. I
can't set subform.visible = false as I can't have the 'add' button!
Any approach I am trying seems to solve one problem but create another. The
last way which I haven't tried is to set all controls .visible to false
except the 'add' button, then I can control when I actually go to the new
record.
I know this is a verbose question and I hope I have explained it clearly. I
have spent more than a day buggering around with different options but can't
get a simple, elegant solution. Any ideas?
Thanks in advance.
swas
As best I can see I
I have a main form with a treeview control, and several subforms on a tab
control. Depending on the treeview node determines the recordsource for the
appropriate subform, and whether it is editable or not. I am controlling the
recordsource to restrict the recordset to a single record to keep network
traffic to a minimum. All this is working fine.
When I want to add a new record, I want to allow this only when a certain
tree level is selected for a given subform, which detecting and controlling
this is fine also. My problem is how to manage the subform fields for a new
record. If I set it to a new record automatically when the appropriate tree
node is selected it means new records can inadvertantly be added without
realising. Because it is a bound form I can't just set the recordsource to
nothing until an 'add' button is pressed as all bound fields show '#Name'
which looks bad. If it is a new record I can't set 'allowedits' to false. I
can't set subform.visible = false as I can't have the 'add' button!
Any approach I am trying seems to solve one problem but create another. The
last way which I haven't tried is to set all controls .visible to false
except the 'add' button, then I can control when I actually go to the new
record.
I know this is a verbose question and I hope I have explained it clearly. I
have spent more than a day buggering around with different options but can't
get a simple, elegant solution. Any ideas?
Thanks in advance.
swas
As best I can see I