Access 2010 - If Then Else Statement to display text within text box upon Check Box True/False condition

I have a form called myForm. On this form is a check box called myCheckBox. I also have a text box labeled myTextBox. I have assigned a macro, myMacro, to run upon selection/click of myCheckBox. The macro is an If statement which determines if myCheckBox
is checked or not checked and spits out a value, "Yes" or "No" for example, into the text box.
I am not able to get text to display into the text box although I am not receiving any errors when I run the macro. This may be a fault in my logic and would like help resolving where the problem lies. I am fairly new to Access so this could be something
simple.
My code is as follows:
If Forms!myForm =  True Then
  Forms!myForm!myTextBox.Value = "Yes!"
ElseIf Forms!myForm = False Then
  Forms!myForm!myTextBox.Value = "No!"
Else
  Forms!myForm!myTextBox.Value = " / ERROR / " 
End if
Thanks!

Hi,
This is the forum to discuss questions and feedback for Microsoft Office, the issue is more related to coding/programing, you'd better post your question to the MSDN forum for Access
http://social.msdn.microsoft.com/Forums/en-US/home?forum=accessdev&filter=alltypes&sort=lastpostdesc
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
George Zhao
TechNet Community Support

Similar Messages

  • Use If then else statement to display concatenated values

    Hi,
    I am trying to create a field which will display 2 different names depending on the status of another field.
    Here is the code I have but it returns no data when I try it:
    <?xdofx:if ReportStatus='Approved' then concatenate(DisplayFirstName, DisplayLastName) else concatenate(InvFirstName, InvLastName) end if?>
    (Also I need to solve how to create a space between the first and last names)
    Any help would be appreciated thanks

    Use the following.
    <?choose:?>
    <?when:ReportStatus='Approved' ?>
    <?DisplayFirstName?> aspace <?DisplayLastName?> or <?concat(DisplayFirstName,' ', DisplayLastName)?>
    <?end when?>
    <?otherwise:?>
    <? InvFirstName?> a space <? InvLastName?>  or <?concat(InvFirstName,' ', InvLastName)?>
    <?end otherwise?>
    <?end choose?>

  • If Then Else Statement in SAP R/3 BW

    Hi,
    Does anyone know how to create an If Then Else statement in BEX?
    Thanks,
    Mounika.

    Hi mounika,
    do this way
    If 'material number' > 0.
    rslt = 'enter into table'.
    else.
    rslt = 15.
    endif.
    A True condition always evaluates to 1, a False condition evaluates to 0.
    for more quieries in bw ..pls go through  the link
    http://sap.ittoolbox.com/groups/technical-functional/sap-bw
    pls reward if helps,
    regards.

  • Java If/Then/Else Statement

    Hello,
    Just wondering if it is possible to call one java file from within another.
    I'm thining wiht an if.then/else statement similar to
    If x==true
    then run file1.java
    else run file2.java
    any examples of this, or if it is even possible would be appreciated.

    This is something like what I would do.
    public class FileRunner {
        public static void main(String [] args) {
            if ( args[0].equals("file1") {
                File1 file1 = new File1();
                file1.init() //method you define in File1 that runs everything that would've been in the File1's main method
            } else if (args[0].equals("file2") {
                File2 file2 = new File2();
                file2.init() //method you define in file2 that runs everything that would've been in the File2's main method
            } else {
                System.err.println("Invalid argument");
                System.exit(1);
    java.exe FileRunner.class file1
    java.exe FileRunner.class file2The other method is to start a new jvm from within java, but that gives you less control than this imo.

  • How to total 2 colums with an -If then else- statement each

    Hello,
    I have 2 colums A en B who generate data based on an “If then else” statement.
    Colum A
    <?xdofx:if (OMZET_YTD_VJ )!='' then ((OMZET_YTD_VJ) * (BM_YTD - BM_YTD_VJ)) div 100 else 0 end if?>
    Colum B
    <?xdofx:if (BM_YTD)!='' then ((BM_YTD) * (OMZET_YTD - OMZET_YTD_VJ)) div 100 else 0 end if?>
    Colum C needs to be the sum of both. Who can help me?
    Thanks a lot.

    Can you send me the RTF template and xml file to [email protected]? I can take a look and try to help.
    Thanks,
    Bipuser

  • Usage of exists in if-then-else statements

    please correct the mistakes in this procedure regarding exists in the use of if then else statement .as i am new to oracle i am unable to do it.
    errors are statement ignored
    exists should be inside the statement;
    CREATE or replace FUNCTION CHECK_FG_Id
    p_LegacyDocumentId VARCHAR2,
    p_LegacyFGroupId VARCHAR2,
    p_TransmissionId INTEGER
    RETURN INTEGER as
    BEGIN
    IF EXISTS
    (Select FG.ControlNo from functionalgroup FG,document D
    WHERE FG.DocumentId=D.Id AND D.TransmissionId=p_TransmissionId
    AND FG.ControlNo=p_LegacyFGroupId AND D.ControlNo=p_LegacyDocumentId ) THEN
    Return 1;
    ELSE
    Return 0;
    END IF;
    end;

    Lots of different ways...One way is as follows:
    CREATE OR REPLACE FUNCTION check_fg_id (
    p_legacydocumentid VARCHAR2,
    p_legacyfgroupid VARCHAR2,
    p_transmissionid INTEGER) RETURN INTEGER AS
    vDoesItExist NUMBER;
    BEGIN
    SELECT COUNT (1)
    INTO vdoesitexist
    FROM functionalgroup fg,
    document d
    WHERE fg.documentid = d.ID
    AND d.transmissionid = p_transmissionid
    AND fg.controlno = p_legacyfgroupid
    AND d.controlno = p_legacydocumentid;
    IF vDoesItExist > 0 THEN
    RETURN 1;
    ELSE
    RETURN 0;
    END IF; /** vDoesItExist > 0 **/
    END check_fg_id;

  • Inserting a 'null' value in an IF THEN ELSE statement

    Greetings,
    I'm using Business Object webi XiR3
    I'd like to return a 'null' value in certain cases for an IF THEN ELSE statement.  Depending on if I format the field as a text or a number, I can return blanks ("") and zeros (0).  However, what I really need to do is leave the field / column formatted as a number and return a 'null' value.  You can see the variable below ... this will return a blank but the column is text.
    Suggestions?
    thanks.
    variable:
    =If([Comp Rate Mid] = 0 And( ([Market Rate 50th].085) - [Annual Total Targeted Comp] >=0) ; ([Market Rate 50th]0.85) - [Annual Total Targeted Comp]; If([Comp Rate Mid] <> 0 And( ([Comp Rate Mid] 0.85) - [Annual Total Targeted Comp] >=0) ; ([Comp Rate Mid]0.85) - [Annual Total Targeted Comp];""))

    I don't think this is possible using a formula, as formulas deal with content, and images can be placed in cells only as 'image fill', which is Format, rather than Content.
    Might be possible using an AppleScript, but I'm not the person to advise you on that.
    Regards,
    Barry

  • Access 2010 Charts - Query runs but Chart displays black screen

    Hi,
    I developed a db in MS Access 2007 on my old PC and everything worked perfectly.  After trying to open it on my new PC using Access 2010 the db works except the charts display as a black area.
    After a bit of playing around I can say for certain that the queries for the charts are running correctly, (and of course the colouring of the chart is correct).
    I tried deleting the charts but I got an error message saying "cant find the OLE library".
    As I'm relatively new to creating exe files for transferring db's I'm thinking I need to bring the ole library with the db?? but I cant seem to find it on my old pc (maybe being stupid)
    Please could you tell me if I'm barking up the wrong tree with this, or if there is a simple fix that I'm overlooking?
    Many thanks
    Tom.

    I was having this exact same problem, then it just stopped. I am using the nouveau driver and I have a tnt2 card.
    IIRC, I was having an unrelated problem with xorg or udev or something was having problems detecting my monitor, it claimed I had two monitors connected, I wrote an xorg.conf file and that fixed the problem. IDK if its is related or not because I don't recall exactly when things started working when I would switch ttys.
    Try using the nouveau driver and see if it does the same thing, it has a kernel module so it might make difference,
    Last edited by RiceKills (2010-07-06 23:39:27)

  • Access 2010 - How to display data from a table into a text box upon combo box selection?

    Hi
    I have a a table with 5 columns: month, year, USD, SGD, BAHT.
    I created a form with a combo box for selection of the month and year, and I would like to set adjacent text boxes to show USD, SGD, BAHT information. How can i go about doing that?
    From the Q&A here, most of them uses the function similar to this "=[Combo0].[Column](1)" to show the data in the text box, but this would require the combo box to list a whole bunch of details if i were to add in more currency values to the
    table. Is it possible to not show this information in the combo box, but still populate data in the textboxes base on a selection on only the "month" and "year" in the combo box.

    Hi,
    According to your description, my understanding is that you want to show only the month/year in the combo box, we can choose the date, and it will display the value of USD/SGD/BAHT based on the month/year.
    If it is, I recommend you try the steps:
    Create a form based on your data source table>Add the combo box>combo box wizard>Find a record on my form based on the value I selected my combo box>Add mouth and year to selected fields
    http://office.microsoft.com/en-us/access-help/create-a-list-of-choices-by-using-a-list-box-or-combo-box-HA010113052.aspx
    If I misunderstand something, please let me know. We may upload some screenshots or a sample through OneDrive.
    Regards,
    George Zhao
    TechNet Community Support

  • IF THEN ELSE STATEMENT IN BeX Query designer

    Hi,
    I want to write a query as follows:
    IF <Value a> is available THEN <Value a> ELSE <Value b>
    I have written it as follows:
    (X>0)X+(X<=0)Y
    The problem with this equation is,  in case X = 0(number Zero) then Y is not getting displayed. But In case X =NULL (or no values) then Y displayed. This is leading to inconsistency in final result. Please help in rectifying the formula incase it is incorrect or is it because of some program bug in BeX?
    Regards
    Madhav

    This works for me...dont understand y its not working with u!!
    it is simple:
    (X<>0)X+(X==0)Y
    If X is 0, then  0X + 1Y = Y
    else
    1X + 0Y = X.
    What result you are getting in both cases?
    as you thing,X value is may not be 0 in your case. It may be 0.00004...something like that...Set Decimal Places to 5 or 6 to X.
    Message was edited by:
            Muralidhar C

  • [BIP Report] Could I use 'like' syntax inside if-then-else statement?

    I have the following contents in my xml, I would like to show the amount of the ChargeAmount, only if the "Code" is starting from "WAF"in my table.
    <Transaction>
         <Account>A</Account>
         <ChargeAmount>200</ChargeAmount>
         <Code>WAF020</Code>
    </Transaction>
    <Transaction>
         <Account>B</Account>
         <ChargeAmount>250</ChargeAmount>
         <Code>WAF003</Code>
    </Transaction>
    <Transaction>
         <Account>C</Account>
         <ChargeAmount>120</ChargeAmount>
         <Code>WNL012</Code>
    </Transaction>
    <Transaction>
         <Account>D</Account>
         <ChargeAmount>200</ChargeAmount>
         <Code>WNL002</Code>
    </Transaction>
    *** Note that the three digits after WAF is variable.
    Display Table:
    Account || ChargeAmount || Code
    A|| 200 ||WAF020
    B|| 250 ||WAF003
    C|| NULL ||NULL
    D|| NULL ||NULL
    In the ChargeAmount column I tried the following syntax, however, both of them does not work well.
    <?if: <xdoxslt:left(Code, 3)>  = 'WAF' ?> then ChargeAmount else ' ' ?end if?>
    <?xdofx if: Code  = 'WAF?' ?> then ChargeAmount else ' ' ?end if?>
    Could any expert provide work around for the above case?
    Thanks!
    Connie

    In the ChargeAmount column I tried the following syntax, however, both of them does not work well.
    <?if: <xdoxslt:left(Code, 3)>  = 'WAF' ?> then ChargeAmount else ' ' ?end if?>
    <?xdofx if: Code  = 'WAF?' ?> then ChargeAmount else ' ' ?end if?>
    incorrect code will not work
    not clear what do you want to do but try
    <?xdoxslt:ifelse(xdoxslt:left(Code,3)='WAF',’yes’,’no’)?>
    or
    <?xdoxslt:ifelse(contains(Code, 'WAF'),’yes’,’no’)?>

  • If then Else statement not working under Computation in APEX

    Hi
    Can anyone help me where I am going wrong? I am trying to use the following code in Computation Process on Submit. I am not able to get the value. It's showing nothing.
    Page:
    *Item Name (Value Required)
    Type
    Static Assignment
    PL/SQL Function Body
    SQL Query (return single value)
    SQL Query (return colon separated value)
    SQL Expression
    PLSQL Expression
    Item Value
    Computation Point
    *Sequence (Value Required)
    Computation Point
    On New Instance (new session)
    Before Header
    After Header
    Before Region(s)
    After Region(s)
    Before Footer
    After Footer
    After Submit
    Source
    *Computation (Value Required)
    BEGIN
    IF :P3_AGING_DAYS <= '0' THEN
    :P3_AGING_BUCKET := 'Within due date';
    elsif :P3_AGING_DAYS > '0' AND :P3_AGING_DAYS <= '3' then
    :P3_AGING_BUCKET := 'Within 3 days';
    end if;
    end;

    1efb2968-171d-43f9-9d5d-d38151735ed7 wrote:
    Please update your forum profile with a real handle instead of "1efb2968-171d-43f9-9d5d-d38151735ed7".
    Can anyone help me where I am going wrong? I am trying to use the following code in Computation Process on Submit. I am not able to get the value. It's showing nothing.
    BEGIN
    IF :P3_AGING_DAYS <= '0' THEN
    :P3_AGING_BUCKET := 'Within due date';
    elsif :P3_AGING_DAYS > '0' AND :P3_AGING_DAYS <= '3' then
    :P3_AGING_BUCKET := 'Within 3 days';
    end if;
    end;
    A PL/SQL Function Body computation has to return a value rather than assigning it to an item in the PL/SQL block (APEX turns the block into the body of a function). The item for which the value is to be computed is specified in the computation properties (P3_AGING_BUCKET).
    begin
      return case
               when :p3_aging_days < 1
               then
                 'Within due date'
               when :p3_aging_days between 1 and 3
               then
                 'Within 3 days'
             end;
    end;

  • Help with setting a condition (if-then-else statements)

    Hello,
    In the following data template I am trying to create a condition for
    SUMAMOUNTPERKELEASE when cs_countfund > 1 in my rtf template.
    <dataTemplate dataSourceRef="xmlpdemo" name="cs_ar_kelease">
         <dataQuery>
              <sqlStatement name="Q_1">
                   <![CDATA[
    select     fm.ke
    ,     ltrim(to_char(fm.ke,'000')) || '-'
    ||     ltrim(to_char(fm.lease#,'000000')) || '-'
    ||     ltrim(to_char(fm.lse_code,'00')) kelease
    ,     fm.ar_doc# ar_doc
    ,     fd.fund
    ,     fd.sub
    ,     ro.lname
    ,     fm.billed_from
    ,     fm.billed_thru
    ,     fm.due_date
    ,     sum(decode(trancode,
              10, fd.amount,
              420, fd.amount,
              421, fd.amount,
              100, fd.amount*-1,
              101, fd.amount*-1,
              102, fd.amount*-1,
              109, fd.amount*-1,
              110, fd.amount*-1,
              112, fd.amount*-1,
              120, fd.amount*-1,
              121, fd.amount*-1,
              122, fd.amount*-1,
              130, fd.amount*-1,
              230, fd.amount*-1,
              0 )) amount
    from     finhist_main fm
    ,     rolodex ro
    ,     finhist_detail fd
    where     fd.fund <> 999
    and     fd.sub <> 99
    and     fm.status not in (106,110,120)
    and     fd.trancode <> 11
    and     fm.ar_doc# < 9000000
    and     fm.rolodex# = ro.rolodex#
    and     fm.lse_code = fd.lse_code
    and     fm.lease# = fd.lease#
    and     fm.ke = fd.ke
    and     fm.ar_doc# = fd.ar_doc#
    group by     fm.ke
    ,     fm.lease#
    ,     fm.lse_code
    ,     fm.ar_doc#
    ,     fd.fund
    ,     fd.sub
    ,     ro.lname
    ,     fm.billed_from
    ,     fm.billed_thru
    ,     fm.due_date
    order by     fm.ke, fm.lease#, fm.lse_code
    ,     fm.ar_doc#
    ,     fd.fund
    ,     fd.sub
    ]]>
              </sqlStatement>
         </dataQuery>
         <dataStructure>
              <group name="G_ke" dataType="varchar2" source="Q_1">
                   <element name="ke" dataType="number" value="KE"/>
                   <element name="SumamountPerke" function="sum" dataType="number" value="G_fund.amount"/>
                   <group name="G_kelease" dataType="varchar2" source="Q_1">
                        <element name="kelease" dataType="varchar2" value="KELEASE"/>
                        <element name="ar_doc" dataType="number" value="AR_DOC"/>
                        <element name="lname" dataType="varchar2" value="LNAME"/>
                        <element name="billed_from" dataType="date" value="BILLED_FROM"/>
                        <element name="billed_thru" dataType="date" value="BILLED_THRU"/>
                        <element name="due_date" dataType="date" value="DUE_DATE"/>
                        <element name="CS_countfund" function="count" dataType="number" value="G_fund.fund"/>
                        <element name="SumamountPerkelease" function="sum" dataType="number" value="G_fund.amount"/>                    <group name="G_fund" dataType="varchar2" source="Q_1">
                             <element name="fund" dataType="number" value="FUND"/>
                             <element name="sub" dataType="number" value="SUB"/>
                             <element name="amount" dataType="number" value="AMOUNT"/>
                        </group>
                   </group>
              </group>
         </dataStructure>
    </dataTemplate>
    <element name="CS_countfund" function="count" dataType="number" value="G_fund.fund"/>
    <element name="SumamountPerkelease" function="sum" dataType="number" value="G_fund.amount"/>     
    I have tried the following conditions in the text form field for SUMAMOUNTPERKELEASE
    <?if:cs_countfund > 1?>
    SUMAMOUNTPERKELEASE
    <?end if?>
    <?xdofx: if :cs_countfund > 1 then
    SUMAMOUNTPERKELEASE end if?>
    <?xdofx: if cs_countfund > 1 then
    SUMAMOUNTPERKELEASE end if?>
    <?choose:?>
    <?when: cs_countfund > 1?>
    SUMAMOUNTPERKELEASE
    <?end when?>
    Nothing seems to work. Help...
    Any suggestions would be greatly appreciated.
    Susie

    Hi,
    I assume that in your resulting XML CS_countfund is written in uppercase.
    So try
    <?if:CS_COUNTFUND > 1?>
    <?SUMAMOUNTPERKELEASE?>
    <?end if?>
    Regards
    Rainer

  • Charactersitic values to be used in IFTHEN ELSE STATEMENT IN QUERY

    scenario: i need to use the characteristic values(not the attributes) to be used in an IF THEN ELSE STATEMENT in query. so i created a formula variable for the characteritic of processing type replacement path, replace with key.The values are not fetched in the result and is displayed as X.
    what should i replace with key,lable, constant or other options whereas  my requirement is the all the values present in the characteristc should be used.
    eg. if char name is xyz and has the values 1,2,3,4,5 till -
    20.
    then in a calculated key figure :(formulavariable =1)* kefig1keyfig2 +not(formulavariable =1)kef2keyfig3.
    this formula variable should have all the values of the characteristic values ie 1,2,3---20.
    2. how should i do get the values of characterstics values in the equation give me the steps in detail..
    3. i do not want to use the attributes, though i tried initally while creating the formual variable i replaced with attribute value, there is was an error and there were no reult.
    i tried to create char. variable  for the characteristic  of manual entr , not ready for input values and gave all the values 1,2,3 --20 as default values and then created formaul variable and repalce with the variable, however this characteristic variable is not at all displayed from the list of variables which will be displayed while creating the formula variable.
    help me out.
    Thanks

    hi srini,
    i have includedthe char in rows. i want you to explain in detail how to use these values in the if then else statement in query.
    i have created a calculated key figure 2= (formual variable =1 & keyfig a =0)* keyfig1kefig2 +not(formual variable =1 & keyfig a =0)keyfig2 *calculated keyfig1.
    so this formula variable of replacement path have ref. to then char. and with what value should it replace, key, name, external char or attribut etc so that i should get the values of the char from 1 to20.
    i donot to repalce with the attribute. i just want the char. values and not thier attributes (1. description 2. the second attribute has the values say abc1,efg2,ghi3 for respective charteristic values.
    ie
    char value               desc                 2nd attrib
    1                            hi                     abc1
    2                            bye                  defg2
    3                            ciao                  ghi3

  • Problem in If-Then-Else formula in report

    Hello guys!
    I use an If-Then-Else statement in a Calculated Key Figure (Cf. <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/23/17f13a2f160f28e10000000a114084/content.htm">Conditional Calculations</a> ) and it works great with basic calculations.
    I have a query (done in BI 7.0) where I display, for each calendar months (via 0CALMONTH), the usage (stored in a normal key figure in hours) of several products.
    I need to take into account only the products that have been used for at least 60% of the time of the highest product for each month. I a single product, for a month, has been used less than 60% of the highest one, it should be considered as not being used at all (so the calculated usage would be = 0), otherwise, its usage is counted as normal.
    In order to achieve this, I thought I would display the normal usage (the regular key figure) in column A, a calculated key figure that determines the MAXimum usage for each month in column B (which should be the same for all products) and another calculated key figure that displays the result of the If-Then-Else statement in column C.
    In rows, I have 0CALMONTH and the products.
    HOWEVER, when I do this, the result is incorrect. This is probably because to determine the MAX usage, I use a local calculation option, which displays the correct maximum usage on each row but it's not correct when used somewhere else.
    <b>MY QUESTION IS: HOW can I display the maximum usage for a month on all rows without using the calculation option (and therefore would be correctly used by the If-Then-Else statement. I tried an aggregation exception but it doesn't really work (it works only on the total, but I need to do the calculation on each individual row).</b>
    <u><b>Any useful comment will be greatly appreciated </b></u>
    Thanks in advance!

    Hi Francal ,
    Have you tried it . The constant selection will work if you have defined the calculated key figure correctly i.e. Aggreagtiomn "Max" with "product" as ref characteristic. Then you have to use this calculated key figure in your query , restrict it by "product" and make it a constant selection.
    The calculated key figure it self  will bring the highest usage for Month + product + ( any other characteristic you have in query ) but this will only apply to result . If you use constant seelction on top of it it will make sure that you see same value for all product for a particular month( and other characteristic combinations if you have ).
    I have built similar queries and it works . By the way which versions of backend and frontend you have ??
    Regards
    Sanjay

Maybe you are looking for