you're making this more complex than it has to be. forget the IIf()
function. and it would help if you would stick with one goal for a couple
posts. each time you respond, you're changing what you say you want to do -
so it's hard for anyone to give you a solution that works.
i'll go with the code you included in this last post:
Me.CmdSHOP.Visible = IIf(InStr(Me![txtSubject], "You've sold your eBay
item:") > 0, True, False)
Me.CmdFIXED.Visible = IIf(InStr(Me![txtSubject], "eBay Item Sold:") >
0, True, False)
if you're running the code in a form set to ContinuousForms view, the change
you make to the *Current* record will be reflected in *all* the records that
show on-screen. the properties will reset appropriately as you move from
record to record - but each time the change will show on all the records
visible on-screen, not just the current record. if you don't want that
effect, you'll have to use the ConditionalFormatting option, and set the
controls to be enabled/disabled, rather than visible/not visible.
but if you don't care about the blanket effect on non-Current records, go
ahead and use VBA code, just keep it simple, as
Me!CmdSHOP.Visible = (InStr(Me!txtSubject, _
"You've sold your eBay item:") > 0)
Me!CmdFIXED.Visible = (InStr(Me!txtSubject, "eBay Item Sold:") > 0)
here's how it works: the RIGHT SIDE of the equation is a complete
expression in itself, which includes a comparison operator (>). the system
evaluates the expression and returns True or False. that return value is
used to set the value of the property named on the LEFT SIDE of the
equation. it's really that simple.
hth
put_upon said:
Thanks for the reply Salad
I am placing this code in my Continuous Forms Current Event
Me.CmdSHOP.Visible = IIf(InStr(Me![txtSubject], "You've sold your eBay
item:") > 0, True, False)
Me.CmdFIXED.Visible = IIf(InStr(Me![txtSubject], "eBay Item Sold:") >
0, True, False)
And I would have thought it would differentiate the records that say
"You've sold your eBay item:"
from the ones that say "eBay Item Sold:
BTW this is used to differentiate beween eBay sales from eBay Shops
and those from ordinary Listings
Thanks for the help