Label or Text Box in place of toggle button

G

Guest

Hi,

Is it possible to use a label or text box in place of the toggle button I
have for the following setup?

Form has option group with two toggle buttons. "With Prices" option value 1
and "Without Prices" option value 2.

Report has code in detail section:

If Form!FormName!Frame = 1 then
Price.Visible = True
ETC.

I want to replace the tan toggle buttons with either label or unbound text
box (maybe click event) to match other form controls.

Any help is appreciated.
Thanks in advance.
Pam
 
O

OldPro

Hi,

Is it possible to use a label or text box in place of the toggle button I
have for the following setup?

Form has option group with two toggle buttons. "With Prices" option value 1
and "Without Prices" option value 2.

Report has code in detail section:

If Form!FormName!Frame = 1 then
Price.Visible = True
ETC.

I want to replace the tan toggle buttons with either label or unbound text
box (maybe click event) to match other form controls.

Any help is appreciated.
Thanks in advance.
Pam

I use labels all the time to replace command buttons. It requires
additional coding, and a label can never receive the focus, but
otherwise works fine. The .specialeffect property can be used to
switch between raised and sunken (alternate between 1 and 2) and the
mouseup event can replace the click( ) event. To show the button
being depressed, switch the .specialeffect in the mouseup event. If
you are trying to emulate a standard pushbutton control, then you will
need to add code to raise the surrounding buttons when one button is
depressed.
 
G

Guest

Old Pro,

I also use labels for "stand alone" command buttons, but I'm wondering how
to use either labels or text boxes in an option group or if I use them
outside the option group what coding needs to be used to get my report detail
to determine if with or without pricing was selected.

Can you help with this?
Thanks,
Pam
 
O

OldPro

Old Pro,

I also use labels for "stand alone" command buttons, but I'm wondering how
to use either labels or text boxes in an option group or if I use them
outside the option group what coding needs to be used to get my report detail
to determine if with or without pricing was selected.

A public variable declared at the form level could keep track of the
currently selected item. Option groups don't work with labels, so you
will have to improvise.

Public Option as integer

Private sub lblButtonDown(iButtonIndex as integer)
me("lblButton" & format(iButtonIndex)).specialeffect=2
end sub

Private sub lblButtonUp(iButtonIndex as integer)

End sub
 
O

OldPro

A public variable declared at the form level could keep track of the
currently selected item. Option groups don't work with labels, so
you
will have to improvise.
' Put this in the form header
Public iButtonSelection as integer

'Put this in the MouseDown event of each label where num is replaced
with the label number
= lblButtonDown(num)
'Put this in the MouseUp event of each label where num is replaced
with the label number
= lblButtonUp(num)

'Add the following code to your form module:

Private sub lblButtonDown(iButtonIndex as integer)
me("lblButton" & format(iButtonIndex)).specialeffect=2
for iButtonTally = 1 to 3
if iButtonTally<>iButtonIndex then
me("lblButton" & format(iButtonIndex)).specialeffect=1
endif
next
end sub

Private sub lblButtonUp(iButtonIndex as integer)
iButtonSelection=iButtonIndex
Select Case iButtonIndex
case 1
' Do something
case 2
' Do something else
End case
End sub

'Something similar can be added to an external form or report:
Private sub report_open
Select Case frmTest.iButtonSelection
case 1
' Do something
case 2
' Do something else
End case
End sub
 

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