Thank you John.
Ilona

  -----Original Message-----
  From: [email protected] [mailto:[EMAIL PROTECTED]
Behalf Of John Viescas
  Sent: Monday, 1 May 2006 3:58 PM
  To: [email protected]
  Subject: RE: [ms_access]MsgBox Error Help Please


  Ilona-

  I assume this code is running in frmAssets.  If so, then use the Exit
event
  instead and do:

  Private Sub ReplacementValueDate_Exit(Cancel As Integer)
  On Error GoTo ReplacementValueDate_Exit_Err

      If (Me.ReplacementValue <> 0) And _
        IsNull(Me.ReplacementValueDate) Then
          Beep
          MsgBox "Please enter Replacement Value Date", vbOKOnly, ""
          Cancel = True
      End If


  ReplacementValueDate_Exit_Exit:
      Exit Sub

  ReplacementValueDate_Exit_Err:
      MsgBox Error$
      Resume ReplacementValueDate_Exit_Exit

  End Sub

  The error is occuring in the GoToControl - you can't change the focus in
the
  LostFocus event.

  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: Friday, April 28, 2006 11:54 PM
  To: [email protected]
  Subject: RE: [ms_access]MsgBox Error Help Please

  Hi John,
  I need more help please.

  In my form "frmAssets" I have 2 controls; [ReplacementValue] and
  [ReplacementValueDate].
  If a Replacement Value is entered I want to force the user to enter a
  Replacement Value Date.

  The following piece of code is converted from a macro I created. I did
this
  so that I could de-bug it, because when this condition is true, the focus
  would not return to the ReplacementValueDate.
  The message box displays and then control goes to MsgBox Error$.
  Can you please give me a clue as to why this is happening?
  I have done similar bits of code but not with dates in them, and I can't
see
  what is wrong with this.
  Thank you in anticipation

  Ilona
  Adelaide, Australia



  Private Sub ReplacementValueDate_LostFocus()
  On Error GoTo ReplacementValueDate_LostFocus_Err

      If (Eval("[Forms]![frmAssets]![ReplacementValue]<>0 And
  [Forms]![frmAssets]![ReplacementValueDate] Is Null")) Then
          Beep
          MsgBox "Please enter Replacement Value Date", vbOKOnly, ""
          DoCmd.GoToControl "[ReplacementValueDate]"
      End If


  ReplacementValueDate_LostFocus_Exit:
      Exit Sub

  ReplacementValueDate_LostFocus_Err:
      MsgBox Error$
      Resume ReplacementValueDate_LostFocus_Exit

  End Sub


  [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