Store Operators like >= OR <= in Microsoft Access











up vote
0
down vote

favorite












I have certain values that are needed for validation in Forms, either they look like Value X >= 0 but it could also be X <= 0, it depends on what operator should be used. How can I store such a value?



(I use MS SQL Server + Access as Frontend)



I basicly wanna store the Value and if it needs to be bigger than or smaller than.










share|improve this question






















  • How then you would use those values after you store them? What are you trying to do? just store them and that's it?
    – Sami
    yesterday










  • @Sami I wanna use them for conditional Formatting, ergo the field value needs to be <= 0 just as an example
    – Badgy
    yesterday










  • It seems to (if I understand) that you just need a boolean TRUE/FALSE for >0 and <0 which is BIT datatype in SQL Server.
    – Sami
    yesterday










  • Can't you just create a computed column for that?
    – Sami
    yesterday















up vote
0
down vote

favorite












I have certain values that are needed for validation in Forms, either they look like Value X >= 0 but it could also be X <= 0, it depends on what operator should be used. How can I store such a value?



(I use MS SQL Server + Access as Frontend)



I basicly wanna store the Value and if it needs to be bigger than or smaller than.










share|improve this question






















  • How then you would use those values after you store them? What are you trying to do? just store them and that's it?
    – Sami
    yesterday










  • @Sami I wanna use them for conditional Formatting, ergo the field value needs to be <= 0 just as an example
    – Badgy
    yesterday










  • It seems to (if I understand) that you just need a boolean TRUE/FALSE for >0 and <0 which is BIT datatype in SQL Server.
    – Sami
    yesterday










  • Can't you just create a computed column for that?
    – Sami
    yesterday













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have certain values that are needed for validation in Forms, either they look like Value X >= 0 but it could also be X <= 0, it depends on what operator should be used. How can I store such a value?



(I use MS SQL Server + Access as Frontend)



I basicly wanna store the Value and if it needs to be bigger than or smaller than.










share|improve this question













I have certain values that are needed for validation in Forms, either they look like Value X >= 0 but it could also be X <= 0, it depends on what operator should be used. How can I store such a value?



(I use MS SQL Server + Access as Frontend)



I basicly wanna store the Value and if it needs to be bigger than or smaller than.







sql-server ms-access






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked yesterday









Badgy

879320




879320












  • How then you would use those values after you store them? What are you trying to do? just store them and that's it?
    – Sami
    yesterday










  • @Sami I wanna use them for conditional Formatting, ergo the field value needs to be <= 0 just as an example
    – Badgy
    yesterday










  • It seems to (if I understand) that you just need a boolean TRUE/FALSE for >0 and <0 which is BIT datatype in SQL Server.
    – Sami
    yesterday










  • Can't you just create a computed column for that?
    – Sami
    yesterday


















  • How then you would use those values after you store them? What are you trying to do? just store them and that's it?
    – Sami
    yesterday










  • @Sami I wanna use them for conditional Formatting, ergo the field value needs to be <= 0 just as an example
    – Badgy
    yesterday










  • It seems to (if I understand) that you just need a boolean TRUE/FALSE for >0 and <0 which is BIT datatype in SQL Server.
    – Sami
    yesterday










  • Can't you just create a computed column for that?
    – Sami
    yesterday
















How then you would use those values after you store them? What are you trying to do? just store them and that's it?
– Sami
yesterday




How then you would use those values after you store them? What are you trying to do? just store them and that's it?
– Sami
yesterday












@Sami I wanna use them for conditional Formatting, ergo the field value needs to be <= 0 just as an example
– Badgy
yesterday




@Sami I wanna use them for conditional Formatting, ergo the field value needs to be <= 0 just as an example
– Badgy
yesterday












It seems to (if I understand) that you just need a boolean TRUE/FALSE for >0 and <0 which is BIT datatype in SQL Server.
– Sami
yesterday




It seems to (if I understand) that you just need a boolean TRUE/FALSE for >0 and <0 which is BIT datatype in SQL Server.
– Sami
yesterday












Can't you just create a computed column for that?
– Sami
yesterday




Can't you just create a computed column for that?
– Sami
yesterday












2 Answers
2






active

oldest

votes

















up vote
0
down vote



accepted










Store the value, as usual, in a field, and the operator in another field as Short Text.



The you can use Eval:



Result = Eval("" & [ValueField] & [OperatorField] & "0")





share|improve this answer





















  • Okay thanks, I have this as the Conditional Formatting in one of the Cols for example Eval("" & [EidamCI] & ELookup("Operator";"dbo_Rohstoffanalyse_Sollwerte";"Rohstoff = 'Eisenoxid' AND Messwertbezeichnung = 'EidamCI'";"Zeitpunkt DESC") & "0,2"), problem is that this doesnt rly work, what does the function return? A boolean value or?
    – Badgy
    yesterday










  • ELookup is your own function, so can't tell, but I guess "0,2"should read "0.2" and semicolons perhaps commas.
    – Gustav
    yesterday










  • Thanks the 0.2 solved it
    – Badgy
    yesterday


















up vote
0
down vote













You can store your value as it is, and to check if this value is positive or not you have two ways




  • First one


Create a computed column to check the Value column as



CREATE TABLE YourTable(
YourValue INT,
IsPositive AS CASE WHEN YourValue < 0 THEN 0 ELSE 1 END
);

INSERT INTO YourTable (YourValue) VALUES
(1), (-1);

SELECT *
FROM YourTable;



  • Second one


Use a CASE expression (or even you can create a view) as



SELECT CASE WHEN YourValue < 0 THEN 0 ELSE 1 END IsPositive,
--...
FROM YourTable;





share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53370375%2fstore-operators-like-or-in-microsoft-access%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote



    accepted










    Store the value, as usual, in a field, and the operator in another field as Short Text.



    The you can use Eval:



    Result = Eval("" & [ValueField] & [OperatorField] & "0")





    share|improve this answer





















    • Okay thanks, I have this as the Conditional Formatting in one of the Cols for example Eval("" & [EidamCI] & ELookup("Operator";"dbo_Rohstoffanalyse_Sollwerte";"Rohstoff = 'Eisenoxid' AND Messwertbezeichnung = 'EidamCI'";"Zeitpunkt DESC") & "0,2"), problem is that this doesnt rly work, what does the function return? A boolean value or?
      – Badgy
      yesterday










    • ELookup is your own function, so can't tell, but I guess "0,2"should read "0.2" and semicolons perhaps commas.
      – Gustav
      yesterday










    • Thanks the 0.2 solved it
      – Badgy
      yesterday















    up vote
    0
    down vote



    accepted










    Store the value, as usual, in a field, and the operator in another field as Short Text.



    The you can use Eval:



    Result = Eval("" & [ValueField] & [OperatorField] & "0")





    share|improve this answer





















    • Okay thanks, I have this as the Conditional Formatting in one of the Cols for example Eval("" & [EidamCI] & ELookup("Operator";"dbo_Rohstoffanalyse_Sollwerte";"Rohstoff = 'Eisenoxid' AND Messwertbezeichnung = 'EidamCI'";"Zeitpunkt DESC") & "0,2"), problem is that this doesnt rly work, what does the function return? A boolean value or?
      – Badgy
      yesterday










    • ELookup is your own function, so can't tell, but I guess "0,2"should read "0.2" and semicolons perhaps commas.
      – Gustav
      yesterday










    • Thanks the 0.2 solved it
      – Badgy
      yesterday













    up vote
    0
    down vote



    accepted







    up vote
    0
    down vote



    accepted






    Store the value, as usual, in a field, and the operator in another field as Short Text.



    The you can use Eval:



    Result = Eval("" & [ValueField] & [OperatorField] & "0")





    share|improve this answer












    Store the value, as usual, in a field, and the operator in another field as Short Text.



    The you can use Eval:



    Result = Eval("" & [ValueField] & [OperatorField] & "0")






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered yesterday









    Gustav

    28.7k51734




    28.7k51734












    • Okay thanks, I have this as the Conditional Formatting in one of the Cols for example Eval("" & [EidamCI] & ELookup("Operator";"dbo_Rohstoffanalyse_Sollwerte";"Rohstoff = 'Eisenoxid' AND Messwertbezeichnung = 'EidamCI'";"Zeitpunkt DESC") & "0,2"), problem is that this doesnt rly work, what does the function return? A boolean value or?
      – Badgy
      yesterday










    • ELookup is your own function, so can't tell, but I guess "0,2"should read "0.2" and semicolons perhaps commas.
      – Gustav
      yesterday










    • Thanks the 0.2 solved it
      – Badgy
      yesterday


















    • Okay thanks, I have this as the Conditional Formatting in one of the Cols for example Eval("" & [EidamCI] & ELookup("Operator";"dbo_Rohstoffanalyse_Sollwerte";"Rohstoff = 'Eisenoxid' AND Messwertbezeichnung = 'EidamCI'";"Zeitpunkt DESC") & "0,2"), problem is that this doesnt rly work, what does the function return? A boolean value or?
      – Badgy
      yesterday










    • ELookup is your own function, so can't tell, but I guess "0,2"should read "0.2" and semicolons perhaps commas.
      – Gustav
      yesterday










    • Thanks the 0.2 solved it
      – Badgy
      yesterday
















    Okay thanks, I have this as the Conditional Formatting in one of the Cols for example Eval("" & [EidamCI] & ELookup("Operator";"dbo_Rohstoffanalyse_Sollwerte";"Rohstoff = 'Eisenoxid' AND Messwertbezeichnung = 'EidamCI'";"Zeitpunkt DESC") & "0,2"), problem is that this doesnt rly work, what does the function return? A boolean value or?
    – Badgy
    yesterday




    Okay thanks, I have this as the Conditional Formatting in one of the Cols for example Eval("" & [EidamCI] & ELookup("Operator";"dbo_Rohstoffanalyse_Sollwerte";"Rohstoff = 'Eisenoxid' AND Messwertbezeichnung = 'EidamCI'";"Zeitpunkt DESC") & "0,2"), problem is that this doesnt rly work, what does the function return? A boolean value or?
    – Badgy
    yesterday












    ELookup is your own function, so can't tell, but I guess "0,2"should read "0.2" and semicolons perhaps commas.
    – Gustav
    yesterday




    ELookup is your own function, so can't tell, but I guess "0,2"should read "0.2" and semicolons perhaps commas.
    – Gustav
    yesterday












    Thanks the 0.2 solved it
    – Badgy
    yesterday




    Thanks the 0.2 solved it
    – Badgy
    yesterday












    up vote
    0
    down vote













    You can store your value as it is, and to check if this value is positive or not you have two ways




    • First one


    Create a computed column to check the Value column as



    CREATE TABLE YourTable(
    YourValue INT,
    IsPositive AS CASE WHEN YourValue < 0 THEN 0 ELSE 1 END
    );

    INSERT INTO YourTable (YourValue) VALUES
    (1), (-1);

    SELECT *
    FROM YourTable;



    • Second one


    Use a CASE expression (or even you can create a view) as



    SELECT CASE WHEN YourValue < 0 THEN 0 ELSE 1 END IsPositive,
    --...
    FROM YourTable;





    share|improve this answer

























      up vote
      0
      down vote













      You can store your value as it is, and to check if this value is positive or not you have two ways




      • First one


      Create a computed column to check the Value column as



      CREATE TABLE YourTable(
      YourValue INT,
      IsPositive AS CASE WHEN YourValue < 0 THEN 0 ELSE 1 END
      );

      INSERT INTO YourTable (YourValue) VALUES
      (1), (-1);

      SELECT *
      FROM YourTable;



      • Second one


      Use a CASE expression (or even you can create a view) as



      SELECT CASE WHEN YourValue < 0 THEN 0 ELSE 1 END IsPositive,
      --...
      FROM YourTable;





      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        You can store your value as it is, and to check if this value is positive or not you have two ways




        • First one


        Create a computed column to check the Value column as



        CREATE TABLE YourTable(
        YourValue INT,
        IsPositive AS CASE WHEN YourValue < 0 THEN 0 ELSE 1 END
        );

        INSERT INTO YourTable (YourValue) VALUES
        (1), (-1);

        SELECT *
        FROM YourTable;



        • Second one


        Use a CASE expression (or even you can create a view) as



        SELECT CASE WHEN YourValue < 0 THEN 0 ELSE 1 END IsPositive,
        --...
        FROM YourTable;





        share|improve this answer












        You can store your value as it is, and to check if this value is positive or not you have two ways




        • First one


        Create a computed column to check the Value column as



        CREATE TABLE YourTable(
        YourValue INT,
        IsPositive AS CASE WHEN YourValue < 0 THEN 0 ELSE 1 END
        );

        INSERT INTO YourTable (YourValue) VALUES
        (1), (-1);

        SELECT *
        FROM YourTable;



        • Second one


        Use a CASE expression (or even you can create a view) as



        SELECT CASE WHEN YourValue < 0 THEN 0 ELSE 1 END IsPositive,
        --...
        FROM YourTable;






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered yesterday









        Sami

        6,26531038




        6,26531038






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53370375%2fstore-operators-like-or-in-microsoft-access%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            'app-layout' is not a known element: how to share Component with different Modules

            android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

            WPF add header to Image with URL pettitions [duplicate]