Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2003
    Posts
    11

    Unanswered: MsgBox Based on Text Box Value - Please HELP!

    I need to know how to display a message whenever the value of a bounded Text Box (Enabled = No) on a form is ZERO when navigating. Thanks.

    I used the following code, but if the First Record is applicable, MsgBox is displayed PRIOR to the form being displayed. when. This code works perfectly otherwise.
    ---------------------------------
    Private Sub Form_Current()

    If Me.txtCheckTextbox = 0 Then
    MsgBox "ZERO value!", vbInformation, "0 Found"
    End If

    End Sub

  2. #2
    Join Date
    Nov 2002
    Location
    Belgium
    Posts
    243

    Re: MsgBox Based on Text Box Value - Please HELP!

    Originally posted by diensatthan
    I need to know how to display a message whenever the value of a bounded Text Box (Enabled = No) on a form is ZERO when navigating. Thanks.

    I used the following code, but if the First Record is applicable, MsgBox is displayed PRIOR to the form being displayed. when. This code works perfectly otherwise.
    ---------------------------------
    Private Sub Form_Current()

    If Me.txtCheckTextbox = 0 Then
    MsgBox "ZERO value!", vbInformation, "0 Found"
    End If

    End Sub

    What if you write following in the Form_Load procedure :

    Code:
    public sub Form_Load()
       txtCheckTextbox.text = ""
    end sub

  3. #3
    Join Date
    Apr 2003
    Posts
    11
    To artemide:

    I tested your code. It didn't work.

  4. #4
    Join Date
    Apr 2003
    Location
    Antwerp, Belgium
    Posts
    9
    Perhaps you should try catching the Null-value as well...

    Code:
    Private Sub Form_Current()
    
    If Nz(Me.txtCheckTextbox, 0) = 0 Then
    MsgBox "ZERO value!", vbInformation, "0 Found"
    End If
    
    End Sub
    Good luck!

    SpSp

  5. #5
    Join Date
    Nov 2002
    Location
    Belgium
    Posts
    243
    Originally posted by diensatthan
    To artemide:

    I tested your code. It didn't work.
    Do you mind to send your code, so I can take a closer look ?

  6. #6
    Join Date
    Apr 2003
    Posts
    11
    To artemide:
    Please see attached DB.

    Purpose of entry form frmDisposals
    ----------------------------------
    1) ContainerID, MaterialName, QtyRemained, and Unit fields are bound
    to table tblReceivals. All these 4 fields are set to (Enabled = False).

    2) There are 3 unbounded fields DisposalQty, DisposalMethod, and DisposalDate.

    3) For each navigated record in table tblReceivals,

    If Me.QtyRemained = 0 Then
    MsgBox "This Container cannot be updated"
    Set Enabled = False for DisposalQty, DisposalMethod, and DisposalDate fields
    Else
    User can dispose any (DisposalQty >0 AND DisposalQty <= QtyRemained)
    QtyRemained = QtyRemained - DisposalQty
    End if

    Eventually, I need to append the Disposal information to table tblDisposals.
    Attached Files Attached Files

  7. #7
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    MsgBox is displayed PRIOR to the form being displayed. when. This code works perfectly otherwise.
    half a workaround:

    Code:
    dim formIsUp as boolean
    
    private sub Form_Current()
      if formIsUp then
        If Nz(Me.txtCheckTextbox, 0) = 0 Then
          MsgBox "ZERO value!", vbInformation, "0 Found"
        End If
      else
        formIsUp = True
      end if
    '.......
    exit sub
    it's only half a workaround, because now your msgbox is not going to show on the first _Current.

    izy

Posting Permissions

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