Results 1 to 4 of 4
  1. #1
    geremore is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    6

    Type mismatch in condition embedded macro

    Hi,

    Got simple form with textbox (EmpName) and button (ViewReport). The On Click embedded macro (of the button) starts with a condition: [EmpName].Text <> ""
    Clicking the button (placed on the same form as the textbox) the condition results in a type mismatch.


    Anybody any idea what might be wrong?

    Thanks in advance,
    Geremore

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I don't use macros but in code you can't use the .Text property of a control unless the control has focus, which it won't when the button is clicked. Try using the .Value property instead.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    geremore is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    6
    OK, that works, thanks!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Embedded Macro Test Strategy
    By bginhb in forum Programming
    Replies: 1
    Last Post: 08-03-2011, 12:59 PM
  2. Embedded macro
    By thart21 in forum Forms
    Replies: 1
    Last Post: 06-28-2011, 12:18 PM
  3. Run a Embedded Macro from VBA Code
    By sabre1 in forum Programming
    Replies: 3
    Last Post: 02-25-2011, 10:26 AM
  4. Replies: 0
    Last Post: 07-13-2010, 07:45 AM
  5. Run Embedded Macro
    By smikkelsen in forum Forms
    Replies: 0
    Last Post: 07-07-2010, 09:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums