Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2003
    Posts
    16

    Unanswered: form called from notinlist

    I am using the notinlist event to add records to a parts
    table. The code is below. My question is what if the
    user decides AFTER he gets into frmMiniParts form that he
    does not want to add the record - how do I get that
    information back to the notinlist subprocedure and set
    Response to acDataErrContinue?

    Thank you.

    Private Sub PartNum_NotInList(NewData As String, Response
    As Integer)
    Dim i As Integer
    Dim Msg As String

    If NewData = "" Then Exit Sub
    Msg = "'" & NewData & "' is not currently in the list."
    & vbCr & vbCr & "Do you want to add it?"
    i = MsgBox(Msg, vbQuestion + vbYesNo, NewData)
    If i = vbYes Then
    DoCmd.OpenForm "frmMiniParts", , , , acFormAdd,
    acDialog, NewData
    Response = acDataErrAdded
    Else
    Response = acDataErrContinue
    End If
    End Sub

  2. #2
    Join Date
    Sep 2004
    Posts
    161
    You can use public variable in module and use like this
    Code:
    --------Module--------
    Public VarDataAdded as Integer
    
    --------Not in List--------- Private Sub PartNum_NotInList(NewData As String, Response
    As Integer)
    Dim i As Integer
    Dim Msg As String
    
    If NewData = "" Then Exit Sub
    Msg = "'" & NewData & "' is not currently in the list."
    & vbCr & vbCr & "Do you want to add it?"
    i = MsgBox(Msg, vbQuestion + vbYesNo, NewData)
    If i = vbYes Then
    DoCmd.OpenForm "frmMiniParts", , , , acFormAdd,
    acDialog, NewData
    Response = VarDataAdded
    Else
    Response = acDataErrContinue
    End If
    End Sub
    --------------In Form frmMiniParts--------------
    Private Sub Btn_Ok_Click()
        VarDataAdded=acDataErrAdded
    End Sub
    
    Private Sub Btn_Cancel_Click()
        VarDataAdded=acDataErrContinue
    End Sub

  3. #3
    Join Date
    Jan 2003
    Posts
    16
    Thanks Jepi - I will give it a try. Thank for such a quick response.
    - jc -

Posting Permissions

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