Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2015
    Posts
    15

    Question Answered: Pop up form, but not as I want to

    So. I am making a DB for registering outgoing mail.

    I want to register who the sender is, and have a Drop Down menu to choos sender. But, if the sender is not in list, then a pop up form to add a new sender appears. The problem is that it's not blank, it contains the information about the last sender in list. Any suggestions?

    My VB code looks like this:

    Option Compare Database

    Private Sub combSender_NotInList(NewData As String, Response As Integer)

    Dim lngsvar As Long

    On Error GoTo MyErr


    lngsvar = MsgBox("BID'en '" & NewData & "' finnes ikke i listen, vil du legge til som ny?", _
    vbQuestion + vbOKCancel, "Mangler BID")

    If lngsvar = vbOK Then
    DoCmd.OpenForm "fNySender", acNormal, , , , acDialog, NewData
    Response = acDataErrAdded

    Else
    Me.combSender.Undo
    Response = acDataErrContinue


    End If


    MyExit:
    Exit Sub

    MyErr:
    MsgBox "Svein har driti seg ut med kodene, få tak i han fortere enn svint, og be han spørre Håvard om hva som er feil", vbCritical, "Dustefeil"
    GoTo MyExit


    End Sub

  2. Best Answer
    Posted by healdem

    "so requery the main form, or requery/refresh the control that contains the data from the table you have just updated
    ...do that from the pop up form, AFTER a row has been completed AND/OR the form closes
    eg

    forms!myparentform.mycombobox.requery

    wrap some error handler around that so the code works if for some reason the parent fom isnt' open"


  3. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    consider setting the datamode parameter (5th parameter) to acFormAdd
    http://www.datawright.com.au/access_..._arguments.htm
    I'd rather be riding on the Tiger 800 or the Norton

  4. #3
    Join Date
    Mar 2015
    Posts
    15
    Quote Originally Posted by healdem View Post
    consider setting the datamode parameter (5th parameter) to acFormAdd
    http://www.datawright.com.au/access_..._arguments.htm
    This did Help. Thank you. Still, new problems occur =) Now the main form wont update... So i have to press f5 to make it update

  5. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    so requery the main form, or requery/refresh the control that contains the data from the table you have just updated
    ...do that from the pop up form, AFTER a row has been completed AND/OR the form closes
    eg

    forms!myparentform.mycombobox.requery

    wrap some error handler around that so the code works if for some reason the parent fom isnt' open
    I'd rather be riding on the Tiger 800 or the Norton

Tags for this Thread

Posting Permissions

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