Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Norfolk, England
    Posts
    744
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Coding problem again (2000)

    Hi,
    I'd quite like this code to work, but for some reason it doesn't. Any ideas?

    Private Sub Estimate_AfterUpdate()
    If IsNull(Me.Estimate) Then
    Exit Sub
    Me.CboFeesClerk = Null
    Me.CboFeesClerk.SetFocus
    MsgBox "Please record your name", vbOK
    End If
    End Sub

    After the field Estimate is updated, I'd like to make CboFeesClerk Null and make the user record their name.
    Is it also possible to play around with the visibility of Comboboxes dependant upon whether values is fields are Null or not?

  2. #2
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Coding problem again (2000)

    Nigel

    After the IsNull statement, if it is null, you are exiting the procedure "Exit Sub".
    Simply commenting that out will enable the msgbox to fire.
    I cant see what you're doing with the combo, or whether it is bound or not.
    Break your code down by commenting lines out to reach the desired effect.

    If it's further help you want, post back.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2004
    Location
    Norfolk, England
    Posts
    744
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Coding problem again (2000)

    Hi Dave,
    Thanks for that.
    After the Set.Focus to CboFeesClerk, is it possible to code it so that the user cannot exit the combobox if the user doesn't enter a value? And would this be done in the coding below, or on an event on CboFeesClerk?

    Private Sub Estimate_AfterUpdate()
    Me.CboFeesClerk = Null
    Me.CboFeesClerk.SetFocus
    MsgBox "Please record your name", vbOK
    End Sub

  4. #4
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Coding problem again (2000)

    Try: Before Update Procedure of the combo::

    <pre>If IsNull([CboFeesClerk]) Then
    MsgBox " You Can Not Exit This Form Until You Have Recorded A Name!! ", vbOKOnly, "!!"

    Cancel = True
    Me.CboFeesClerk.SetFocus
    Exit Sub
    End If</pre>


  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Coding problem again (2000)

    You need to add a check for spaces as well. One of the tricks I've seen users employ in a field that requires input is to enter a space! Try

    <code>If IsNull([CboFeesClerk]) Or Len(Trim([CboFeesClerk])) = 0 Then</code>
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •