Prev: Simple Word Doc Viewer
Next: NameMap = Begin
From: Douglas J. Steele on 19 Jul 2010 07:01 "Phil" <phil(a)stantonfamily.co.uk> wrote in message news:EbidndVwHvgSndnRnZ2dnUVZ8tydnZ2d(a)brightview.co.uk... > On 19/07/2010 03:05:19, "Douglas J. Steele" wrote: >> "Phil" <phil(a)stantonfamily.co.uk> wrote in message >> news:GOqdnTh2BuDN7d3RnZ2dnUVZ8nydnZ2d(a)brightview.co.uk... >>> On 16/07/2010 12:49:40, "Douglas J. Steele" wrote: >>>> My advice would be to use >>>> >>>> [Forms]![frmHidden]![txtAgency] Or >>>> [Forms]![frmHidden]![txtAgency]="Director" >>>> >>>> although you could also just put Like in front of what you've currently >>>> got: >>>> >>>> Like >>>> IIf([Forms]![frmHidden]![txtAgency]="Director","*",[Forms]![frmHidden]![txtAgency]) >>>> >>> >>> Try putting another field on your form TxtAgencyRelay with the >>> ControlSource >>> '=IIf([TxtAgency]) = "Director", "*"[TxtAgency])' >>> >>> and your query criteria >>> Like [Forms]![frmHidden]![txtAgencyRelay] >> >> That won't work Phil, if only because the IIf statement is invalid syntax >> (looks as though you left out a comma). Even if you correct the syntax, >> though, I think you'll find it won't do what's asked for. >> > > Hi Douglas > Typo error Should be '=IIf([TxtAgency]) = "Director", "*",[TxtAgency])' > > I use a similar routine to select surnames based on an initial letter > selected from a grid where I load that letter into into a field on the > form, > or if I choose the "All" option it loads an * into the field. Works fine My apologies. I see now what you're trying to do. I don't see any advantage, though, of adding an additional control to the form vs. having the query do the work. -- Doug Steele, Microsoft Access MVP http://www.AccessMVP.com/DJSteele Co-author: Access 2010 Solutions, published by Wiley (no e-mails, please!)
From: Phil on 19 Jul 2010 08:07 On 19/07/2010 12:01:09, "Douglas J. Steele" wrote: > "Phil" <phil(a)stantonfamily.co.uk> wrote in message > news:EbidndVwHvgSndnRnZ2dnUVZ8tydnZ2d(a)brightview.co.uk... >> On 19/07/2010 03:05:19, "Douglas J. Steele" wrote: >>> "Phil" <phil(a)stantonfamily.co.uk> wrote in message >>> news:GOqdnTh2BuDN7d3RnZ2dnUVZ8nydnZ2d(a)brightview.co.uk... >>>> On 16/07/2010 12:49:40, "Douglas J. Steele" wrote: >>>>> My advice would be to use >>>>> >>>>> [Forms]![frmHidden]![txtAgency] Or >>>>> [Forms]![frmHidden]![txtAgency]="Director" >>>>> >>>>> although you could also just put Like in front of what you've currently >>>>> got: >>>>> >>>>> Like >>>>> IIf([Forms]![frmHidden]![txtAgency]="Director","*",[Forms]![frmHidden]![txtAgency]) >>>>> >>>> >>>> Try putting another field on your form TxtAgencyRelay with the >>>> ControlSource >>>> '=IIf([TxtAgency]) = "Director", "*"[TxtAgency])' >>>> >>>> and your query criteria >>>> Like [Forms]![frmHidden]![txtAgencyRelay] >>> >>> That won't work Phil, if only because the IIf statement is invalid syntax >>> (looks as though you left out a comma). Even if you correct the syntax, >>> though, I think you'll find it won't do what's asked for. >>> >> >> Hi Douglas >> Typo error Should be '=IIf([TxtAgency]) = "Director", "*",[TxtAgency])' >> >> I use a similar routine to select surnames based on an initial letter >> selected from a grid where I load that letter into into a field on the >> form, >> or if I choose the "All" option it loads an * into the field. Works fine > > > My apologies. I see now what you're trying to do. > > I don't see any advantage, though, of adding an additional control to the > form vs. having the query do the work. > Apology accepted. You're probably right about it being a complex way of doing things, but that method works, and the OP seemed to be having dificulties with his query Phil
From: Vet Tech on 19 Jul 2010 16:33
It appears it may have been a Null problem. I used the Nz thingie and it has worked out OK so far. This is what I put in:- Like Nz([forms]![frmHidden]![txtAgency],"") & "*" Many thanks anyway for your suggestions. VT |