Re: Control with condition

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Frankie (Frankie_at_discussions.microsoft.com)
Date: 01/12/05


Date: Wed, 12 Jan 2005 14:03:02 -0800


"AlCamp" wrote:

> Frankie,
> I tested my last solution...
> >> If IsNull(IDContrat) Then
> >> [Forms]![F_Interimaires]![Etat] = "Candidat"
> >> Else
> >> [Forms]![F_Interimaires]![Etat] = "Interimaire"
> >> End If
> on a test database I have (using the same concept with my names and
> controls), and it worked fine. In the subform, when I changed the
> [IDContrat] value, a bound field on the main form "reflected" those changes.
> So... there may be something missing from your explanantion of your
> "setup."
> hth
> Al Camp
>
> "Frankie" <Frankie@discussions.microsoft.com> wrote in message
> news:E3AA8CBD-C534-4888-A172-CCAD962F94D5@microsoft.com...
> >
> >
> > "AlCamp" wrote:
> >
> >> Frankie,
> >> You wrote...
> >> Al proposal - =IIF(IsNull([Forms]![F_Interimaires]![F_FicheContrat
> >> sous-formulaire].Form![IDContrat),"Candidat","Interimaire")
> >> (You are missing a right bracket on [IDContrat].)
> >>
> >> I don't think Penguin's solution will work, I've never seen the
> >> IsNull
> >> function expressed that way, and as far as I know, every IIF syntax must
> >> denote a True and False...
> >> IIf(expr, truepart, falsepart)
> >> I haven't tested his solution... my apoplogies if I'm mistaken
> >>
> >> The IIF calculation I posted is meant to be the Control Source of an
> >> unbound field on the main form. Since IDContrat (null or not) always
> >> determines Candidat or Interimaire, it is not necessary to save that
> >> calculation in [Etat]... you just always "display" the calculation on the
> >> main form.
> >> In other words, since you always have IDContrat, you can always
> >> recalculate Etat "on the fly".
> >>
> >> Now, if you must save "Candidat" or "Interimaire" in [Etat] in your
> >> table, then "bind" [Etat] to the Etat field, and use the AfterUpdate
> >> event
> >> of IDContrat itself with this code...
> >>
> >> If IsNull(IDContrat) Then
> >> [Forms]![F_Interimaires]![Etat] = "Candidat"
> >> Else
> >> [Forms]![F_Interimaires]![Etat] = "Interimaire"
> >> End If
> >>
> >> will update the field with the correct value.
> >>
> >> hth
> >> Al Camp
> >>
> >> "Frankie" <Frankie@discussions.microsoft.com> wrote in message
> >> news:28D5F0B1-6156-4E9E-B52A-B4362BA33C89@microsoft.com...
> >> >
> >> >
> >> > "Penguin" wrote:
> >> >
> >> >> The text box on the main forms Control Source should look like this:
> >> >>
> >> >> =IIf([Forms]![FormName]![ControlName].[Form]![SubFormControlName] Is
> >> >> Null,"ValueYouWant")
> >> >>
> >> >> Hope this helps
> >> >>
> >> >> On Mon, 10 Jan 2005 14:01:05 -0800, "Frankie"
> >> >> <Frankie@discussions.microsoft.com> wrote:
> >> >>
> >> >> >I have a form with a subform : on the form there is a control
> >> >> >(textbox)
> >> >> >wich
> >> >> >value should depend upon the checking of another control 's value
> >> >> >that's
> >> >> >located on the subform (If the value is Null then value1otherwise
> >> >> >value2). I
> >> >> >think the IIf function is the one to use but I can't get it to work.
> >> >> >I have also tried the If....Then...esle to no avail.
> >> >> >Can someone please help me with the best way to do it. ??
> >> >> >Version : Access 2002
> >> >> >Thanks in advance
> >> >>
> >> >> Thanks to both of you for your help.
> >> > I am still confused :
> >> > A-your solution seems to differ
> >> > B- When I write either one (as code) in the BeforeUpdate event of the
> >> > textbox [Etat] of main form [F_Interimaires] I keep getting syntax
> >> > error
> >> > Here is what I put within Private Sub procedure:
> >> > Penguin
> >> > proposal -IIf([Forms]![F_Interimaires]![Etat].[Form]![IDContrat]
> >> > IsNull,"Candidat","Interimaire")
> >> > Al proposal - =IIF(IsNull([Forms]![F_Interimaires]![F_FicheContrat
> >> > sous-formulaire].Form![IDContrat),"Candidat","Interimaire")
> >> > Is there something I should add within Private Sub like a Call
> >> > function
> >> > and if so how do I write it ??
> >> > Also, I am based in Paris so please take the time difference into
> >> > account
> >> > when expecting an answer from me .
> >> > Waiting to read from you soon
> >>
> >>
> >> Since [Etat] is bound to a table I opted for AfterUpdate Event on
> >> [IDContrat] on subform with your solution or Tina's. The problem is that
> >> it still does not work and I really don't get it!!!
> > The subform is used on another form, could that make a difference ??
> > Thanks for your continuing support
> >
>
>
> It does work !!
Tha



Relevant Pages

  • Re: Control with condition
    ... > on a test database I have (using the same concept with my names and ... > controls), and it worked fine. ... > Al Camp ... >> Thanks for your continuing support ...
    (microsoft.public.access.formscoding)
  • Re: How to bid a simple hand, part 1
    ... I am strongly in the "support with support" camp. ... here you have 13 nice HCP with good controls and ...
    (rec.games.bridge)
  • Re: change variables
    ... You disagree that maintaining code introduces an element of risk? ... Fujitsu provides support classes for Database/ File access, Java, ... I only searched registered controls, ...
    (comp.lang.cobol)
  • RE: Adapting ReorderList WebControl for rendering dynamic html
    ... you want to show different controls in each ... ReorderListItem item = container as ReorderListItem; ... public class MyData ... Microsoft Online Community Support ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • RE: Whats so special about "Update"
    ... are usually displayed in text boxes or other controls in which users can ... DataSource in the custom command event. ... Microsoft Online Support ...
    (microsoft.public.dotnet.framework.aspnet)