Managing controls on subform

Z

ZRexRider

Hi,


I have sub form that displays a result set in its detail section with a
delete button next to each row. It replicates automatically nicely.


sssss1 xxxxxxx 1111111 33333333 [Delete Button]
sssss2 xxxxxxx 1111111 33333333 [Delete Button]
sssss3 xxxxxxx 1111111 33333333 [Delete Button]


Is there any way to manipulate one of these buttons individually?
Sometimes I want to remove a delete button based on position within the
result set.




Thanks
 
S

Sprinks

Hi, ZRex.

The properties of controls on a continuous subform can only have a single
value, i.e., they cannot have a different value for different records.
However, you could use the OnCurrent event to change the Visible or Enabled
property of the button based on your criteria for the active record. Note
that it will show the new status on all records.

If <YourCriteria> Then
MyCommandButton.Enabled = True
Else
MyCommandButton.Enabled = False
End If

Sprinks
 
Z

ZRexRider

RE: Note that it will show the new status on all records. ----

That seems kinda yucky though.

Follow up question - each row in the continuous subform has it's own
combo box. I have a need to pop up a form that prompts user to select
"canned text" from a combo box or enter "custom text" which I would
like to pass back to a text field in the calling subform in the same
row of the continuous form.

So having the following 3 rows in my subform:

sssss1 xxxxxxx 1111111 33333333 [Combo1]
[ Reason Notes ]

sssss2 xxxxxxx 1111111 33333333 [Combo2]
[ Reason Notes ]

sssss3 xxxxxxx 1111111 33333333 [Combo]3
[ Reason Notes ]


User selects a value in from combo2 I will pop up a simple form. When
that form closes I want to write back to the [Reason Notes ] Field on
the same row as the combo2.

I tried to pass it back to the recordset with something like this:

Forms!frmMainForm.frmSubForm.Form.Recordset.Fields("chrvReason") =
Me.txtCustomRejectionReason.Value

and access died a horrible death.

In many ways the continuous form serves me very well but I sure would
be happy if I could address every property of every object.

Thanks for your reply
 
S

Sprinks

I'm struggling to meet a deadline this afternoon, so I probably won't be able
to ask your 2nd question until tomorrow, but I had another thought on the
command button.

Certainly "yucky" is in the eyes of the beholder, but I can see your point.
You could, however, keep it enabled and deal with your criteria in the
command button code:

If YourCriteria Then
MsgBox "Command button feature is not enabled for this record."
Else
Do Your Stuff
End If

Sprinks
 
Z

ZRexRider

Sprinks,

Yeah - that's what I'm doing now (your example with the message box).

Thanks for the response and the help and good luck with your deadline!

Zrex
 
S

Sprinks

ZRex,

I'm not clear on how each row of your subform has "its own" combo box, since
a combo box can only have a given set of properties for all records on the
subform at any given time.

The syntax, though, for refering to a subform control, using the convention
of the Bang (!)operator to delimit objects and the dot (.) operator to
delimit an object from its properties and methods, is:

Forms!MainForm!SubformControlOnMainForm.Form!YourSubformControl

or

Forms!frmMainForm!frmSubForm.Form!chrvReason

Sprinks
 
Z

ZRexRider

Thanks again Sprinks....

Yes each row has a combo box where an auditor can choose to the results
of their audit of that particular line item. They can choose Submit,
Reject, Review.... and others. I have no problems setting each one of
these combo boxes to different values and they don't effect each other.
(Exactly what I expected - but the more I learn about continuous forms
I wonder why it works myself).

The team wanted to prompt for a "reason" if the auditor rejected a line
and they wanted to supply a combo box of "standard" responses. They
also want to allow the user to ad-lib (enter their own reason - but not
add their ad-lib to the database of standard responses). So ... I
opted to pop up a small form with a combo and a text box. When they
close that popup form I will take their choice/ or ad-lib text and then
I want to write it back to a text box on the continuous form at the
row/record where they selected "rejected" in the combo. This is why I
wanted to be able to address a text field directly.

I figured the pop-up form could receive the row/item coordinates from
the calling form and then set the text value of that record when it
exits.

Thanks again for your help and have a great day.
 
Top