acDialog - Form Invisible?

Discussion in 'Access VBA Modules' started by Faraz Ahmed Qureshi, Jun 1, 2010.

  1. ACCESS2007

    The code was working well:

    Private Sub Login_id_NotInList(NewData As String, Response As Integer)
    On Error GoTo NtInList_Err
    Dim intAnswer As Integer
    intAnswer = MsgBox("The login ID " & Chr(34) & NewData & _
    Chr(34) & " is not currently listed." & vbCrLf & _
    "Would you like to add it to the list now?" _
    , vbYesNo, "BC")
    If intAnswer = vbYes Then
    DoCmd.OpenForm "User", , , , acFormAdd, acDialog
    Form_User.Login_id = NewData
    Response = acDataErrAdded
    Else
    MsgBox "Please choose a name from the list." _
    , vbInformation, "BC"
    Response = acDataErrContinue
    End If
    NtInList_Exit:
    Exit Sub
    NtInList_Err:
    MsgBox Err.Description, vbCritical, "Error"
    Resume NtInList_Exit
    End Sub

    But now the FORM "USER" doesn't appear and the database seems to be hanged.
    However, upon Tab, the field names seem to be appearing on the bottom bar?
     
    Faraz Ahmed Qureshi, Jun 1, 2010
    #1
    1. Advertisements

  2. On Tue, 1 Jun 2010 00:11:01 -0700, Faraz Ahmed Qureshi

    I doubt that very much. What you are attempting to do is to first open
    form User in dialog mode, then on the next line set the Login_id. That
    next line won't run until AFTER the form closes, so it is not a good
    way to pass information to the form. Use the OpenArgs argument of
    DoCmd.Openform instead.
    Secondly acFormAdd depends on several conditions. For a test remove
    this argument. Also check that the form uses an updatable recordset
    (if not, can't acformadd, right?) and that the form's AllowAdditions
    property is set to True.

    -Tom.
    Microsoft Access MVP
     
    Tom van Stiphout, Jun 1, 2010
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.