Thank you John. I like it.
I knew I was going about it the wrong way because something so simple should
not have been so hard.
Thank you again for all your help.

Ilona
Adelaide, Australia
  -----Original Message-----
  From: [email protected] [mailto:[EMAIL PROTECTED]
Behalf Of John Viescas
  Sent: Wednesday, 10 May 2006 4:30 PM
  To: [email protected]
  Subject: RE: [ms_access] Default Value/Event Procedure Help


  Ilona-

  Instead of defining the default value, set the value to "N" in the Load
  event and place the focus there.  I believe AfterUpdate will fire if the
  user presses Enter because you have "dirtied" the control.

  But what is it you're trying to do?  Get the user to make a decision with
a
  default of "no?"  If so, a MsgBox is much cleaner:

    If vbYes = MsgBox("Are you sure you want to do this?", _
      vbQuestion + vbYesNo = vbDefaultButton2) Then

  The above displays a message box dialog with Yes and No buttons, a
question
  mark icon, and the second button (the NO) set as the default.  If the user
  just presses Enter, the answer back will be vbNo.  If the user tabs to the
  other button or clicks it, the answer will be vbYes.

  John Viescas, author
  Building Microsoft Access Applications
  Microsoft Office Access 2003 Inside Out
  Running Microsoft Access 2000
  SQL Queries for Mere Mortals
  http://www.viescas.com/
  (Paris, France)
  For the inside scoop on Access 2007, see:
  http://blogs.msdn.com/access/


  -----Original Message-----
  From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf
  Of Ilona Wright
  Sent: Wednesday, May 10, 2006 7:32 AM
  To: [email protected]
  Subject: RE: [ms_access] Default Value/Event Procedure Help

  Hi there,
  I have an unbound text box in a form which is to store a user response of
  "Y" or "N".
  I have set the default value as "N".

  I want the form to close if the user keys "N" followed by the Enter key,
or
  if the user presses just the Enter Key.

  If I press "N" followed by the Enter key, I can get the form to close in
the
  AfterUpdate event procedure.

  But
  If I just accept the default value by pressing the Enter key only without
  keying N first, the AfterUpdate event procedure does not process.

  By having MsgBoxes display at each event I discovered that pressing Enter
  only, causes the On Exit event procedure to run.
  But if I try to close the form in the On Exit event procedure I get an
error
  message

  "This action can't be carried out while processing a form or report event.

  A macro specified as the OnOpen, OnClose, OnFormat, Onretreat, OnPage, or
  Onprint property setting contains an invalid action for the property.

  When you click OK, an Action failed dialogue box will display the name of
  the macro that failed and its arguments."

  And it is the close form that displays.

  Am I having this problem because the text box is an unbound control?

  How do I get this to work? I could use command buttons but I do not want
to
  in this instance?
  Can you help me please?
  Thank you very much
  Ilona
  Adelaide, Australia




  [Non-text portions of this message have been removed]





  Yahoo! Groups Links










  SPONSORED LINKS Microsoft access database  Database development software
Database management software
        Database software  Inventory database software  Membership database
software


----------------------------------------------------------------------------
--
  YAHOO! GROUPS LINKS

    a..  Visit your group "ms_access" on the web.

    b..  To unsubscribe from this group, send an email to:
     [EMAIL PROTECTED]

    c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.


----------------------------------------------------------------------------
--



[Non-text portions of this message have been removed]



SPONSORED LINKS
Microsoft access database Database development software Database management software
Database software Inventory database software Membership database software


YAHOO! GROUPS LINKS




Reply via email to