Results 1 to 3 of 3

Thread: NotInList

  1. #1
    Join Date
    Mar 2004
    Location
    Greenville, SC
    Posts
    271

    Wink Unanswered: NotInList

    I have set up code in a NotinList Combo Box. I have it adding a New Company based on the data entered. See the code below. I have gone through just fine. It opened my other form and entered the data just as I wished it to. Then, when I try to close the file or save and close, everything just locks up?? Any ideas of what might be happening?
    help!!

    Form A

    Private Sub BillToID_NotInList(NewData As String, Response As Integer)
    If MsgBox("The Company " & NewData & " you entered, does not exist yet." & vbCrLf & vbCrLf & "Do You wish to add it?", vbQuestion + vbYesNo) = vbYes Then
    DoCmd.OpenForm "FrmEnterCompany", acNormal, , , acFormAdd, acDialog, NewData
    Response = acDataErrAdded
    Else
    Response = acDataErrContinue
    End If
    End Sub

    Form B

    Private Sub Form_Load()
    If Not IsNull(Me.OpenArgs) Then
    Me!Customer = Me.OpenArgs
    End If
    End Sub
    Gotta to do some code

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    Try This:
    Code:
    Private Sub BillToID_NotInList(NewData As String, Response As Integer)
      If MsgBox("The Company " & NewData & " you entered, does not exist yet." & _
          vbCrLf & vbCrLf & "Do You wish to add it?", vbQuestion + vbYesNo) = vbYes Then
          Response = acDataErrAdded
          BillToID.RowSource = BillToID.RowSource & ";" & NewData
          DoCmd.OpenForm "FrmEnterCompany", acNormal, , , acFormAdd, acDialog, NewData
       Else
          Response = acDataErrContinue
          BillToID.Undo
       End If
    End Sub
    Form B
    Code:
    Private Sub Form_Open()
       If Not IsNull(Me.OpenArgs) Then
          Me!Customer = Me.OpenArgs
       End If
    End Sub
    Set your Response before Form B is opened. You see, any code that is placed after a Form that is opened in Dialog mode, will not run until the Form is closed.


  3. #3
    Join Date
    Mar 2004
    Location
    Greenville, SC
    Posts
    271

    Unhappy No,luck

    I tried this. Everything goes fine. When I get to the AddCompany form I can enter Information about the new customer, but when I save or try to close the form it just locks up????
    I have a macro that starts when I open the form. Maybe this is the culprit. It sets a new BillToID Number automatically.
    The Macro info is:
    On the BeforeInsert line I use a Macro
    Action:
    Set Value
    Item- [Forms]![FrmEnterCompany]![BillToID]
    Expression-DMax("[BillToID]","TblBillTo")+1
    GoToControl
    Control Name-Customer

    Help!!!!!!!!!!!1
    Gotta to do some code

Posting Permissions

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