Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

condition expression type mismatch error

Discussion in 'Information Technology' started by kennethburr@sbcglobal.net, Jul 28, 2006.

  1. kennethburr@sbcglobal.net

    kennethburr@sbcglobal.net
    Expand Collapse
    Guest

    I have tried to write a macro in Access 2003 that will result in a
    message box when the value in a field is $25,000 or more. The field
    type is set to currency. The field name is IHDAconstruction$. The form
    name where the macro appears is IHDAProjectsForm. The condition
    statement in my macro is
    [Forms]![IHDAProjectsForm]![IHDAconstruction$]>=25000. However,
    whenever I try to run this macro I get a type mismatch error. I have
    tried with and without a $ sign in front of the 25000. I have also
    tried with and without quotes around the 25000. And I still get a type
    mismatch error. Any help would be greatly appreciated.
     
  2. Loading...

    Similar Threads Forum Date
    I am feeling very very down right now ... What can I do to improve my condition. A hopeless feeling. Sikh Youth Oct 15, 2013
    India Condition Of Shaheed Udham Singh's Family... Breaking News Aug 9, 2011
    Inspirational Unconditional love for the Guru Videos Sep 4, 2010
    General Unconditional Love Hard Talk Jun 28, 2008
    Pure and Unconditional Love for God Gurmat Vichaar Feb 18, 2008

  3. Tom Wickerath

    Tom Wickerath
    Expand Collapse
    Guest

    Hi Kenneth,

    I have just replicated your form, using the same field name and form name,
    along with macro condition. I used the Before Update event procedure for the
    macro. It works fine for me.

    If you still cannot get it to work, you might want to try using a validation
    rule, with the appropriate validation text, in table design view.

    Validation Rule: Between 0 And 24999.99
    Validation Text: Please enter a valid dollar amount.


    Tom Wickerath
    Microsoft Access MVP

    http://www.access.qbuilt.com/html/expert_contributors.html
    http://www.access.qbuilt.com/html/search.html
    __________________________________________


    "kennethburr@sbcglobal.net" wrote:

    > I have tried to write a macro in Access 2003 that will result in a
    > message box when the value in a field is $25,000 or more. The field
    > type is set to currency. The field name is IHDAconstruction$. The form
    > name where the macro appears is IHDAProjectsForm. The condition
    > statement in my macro is
    > [Forms]![IHDAProjectsForm]![IHDAconstruction$]>=25000. However,
    > whenever I try to run this macro I get a type mismatch error. I have
    > tried with and without a $ sign in front of the 25000. I have also
    > tried with and without quotes around the 25000. And I still get a type
    > mismatch error. Any help would be greatly appreciated.
    >
    >
     
  4. kennethburr@sbcglobal.net

    kennethburr@sbcglobal.net
    Expand Collapse
    Guest

    Thanks for you quick reply. I also was using the Before Update event
    proceedure and either I would get the type mismatch error or the macro
    would not run at all. I still don't understand why it doesn't work, but
    at least thanks to your suggestion I know I have an alternative.
    Thanks very much.
    Ken Burr
     
  5. Tom Wickerath

    Tom Wickerath
    Expand Collapse
    Guest

    Hi Kenneth,

    You're welcome. I'm not a big fan of using macros in any case. In all
    current versions of Access, there is no way to trap for errors. This has been
    addressed in the next version of Access, which is currently in beta 2 release.

    Consider the following quote:

    From: "Inside Relational Databases, 2nd Edition, by Mark Whitehorn and Bill
    Marklyn, published by Springer, p 151)

    "Macros offer the next level down, extending the functionality of the GUI.
    Macros are still limited, however, and do not provide anything like the
    enormous flexibility of a programming language. Both the macro and the
    programming languages take some effort to learn and, surprisingly, often
    require relatively different skills; in other words, a good working knowledge
    of macros may not make it much easier to convert to using the programming
    language. Perhaps even more surprisingly, I do not believe that programming
    is fundamentally more difficult to learn. Macros are easier to use but not by
    orders of magnitude."

    "If you are new to RDBMSs, I suggest (with as much deference as possible)
    that you may well not be in a position to judge whether you need macros or
    programming. In that case, my advice is clear. Unless you are sure that your
    needs really are simple, don't bother learning to use macros. Once you find
    that you need more than the GUI offers, go straight to the programming
    language. In this way you avoid the pain of climbing one learning curve only
    to discover that the view from the top is unsatisfactory and another climb
    awaits you."


    Tom Wickerath
    Microsoft Access MVP

    http://www.access.qbuilt.com/html/expert_contributors.html
    http://www.access.qbuilt.com/html/search.html
    __________________________________________

    "kennethburr@sbcglobal.net" wrote:

    > Thanks for you quick reply. I also was using the Before Update event
    > proceedure and either I would get the type mismatch error or the macro
    > would not run at all. I still don't understand why it doesn't work, but
    > at least thanks to your suggestion I know I have an alternative.
    > Thanks very much.
    > Ken Burr
     

Share This Page