Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why can't I toggle my toggle? :) 2

Status
Not open for further replies.

KCcasey

Programmer
Sep 30, 2003
69
NZ
Hi Everyone!

First of all, thanks in advance for the help! This should be an easy one, but I'm at a loss. I want to 'toggle' a toggle button
based on results from a recordset.

Heres the code I've been attempting to use:

Code:
Select Case objRecordSet("PSsentBy")

Case "Neil Watts"
Me.Controls!Toggle75.Value = True

Case "Tracy Gilliespie"
Me.Controls!Toggle76.Value = True

Case "Melanie Gillett"
Me.Controls!Toggle77.Value = True

Case "Debra Sinclair"
Me.Controls!Toggle78.Value = True

End Select

Heres the error msg I receive when i try to set the toggle buttons value:


Run-time error '2448': You can't assign a value to this object.


... thanks again for the help.

Casey.
 
Try something like
Code:
Toggle76.OptionValue = True

(assuming the toggle is bound to a true/false column)

Hope this helps,

Alex

Ignorance of certain subjects is a great part of wisdom
 
Replace all Me.Controls!Toggle with Me!Toggle

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi Guys,

thanks for your prompt feedback! I tried Alex's fix first - - that ran without raising an error. However the option button on the form doesn't depress, which is kinda what I was really after... extra star anyone??? :)

Regards,

Casey.
 
Aren't by chance the option buttons grouped in a frame ?
I this is the case then simply set the frame value to the appropriate value.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi PHV,

Yes the toggle buttons are grouped in a frame - - what is the property of the frame that controls the currently selected option?

I'm currently use ADO to return a value, based on which I want to select a specific toggle. Bear with me here - - as my frame isn't based on an underlying table, its referred to as an unbound frame, correct? Does that affect the properties available?

Thanks,

Casey
 
what is the property of the frame that controls the currently selected option
I guess its Value property.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Beautiful, works like a charm. Thanks for helping out a VBA noob.

Kind Regards,

Casey.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top