RE: Open form On not in list

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: audreybmorin (audreybmorin_at_discussions.microsoft.com)
Date: 06/29/04


Date: Tue, 29 Jun 2004 07:52:03 -0700

My code is similar to yours. However, when I open the input form, the field on the main form remains popped open so I can't modify it or requery it so the new value shows up. Any ideas?

"Byron" wrote:

> Here is the code that I am using on a form to open another
> form using the OnNotInList event of the combo box,
> including a message to the user. I am opening this form in
> the "Add" mode (see the parameter in the DoCmd.OpenForm
> method). Watch out for word wraping!
>
> Private Sub cboAdjusterTitleID_NotInList(NewData As
> String, Response As Integer)
> 'you won't need the statement above, as it will already
> 'be there
>
> 'just place the code below in the On Not In List event
> Dim strMsg As String, strFName As String, strLname As
> String, strListType As String
> Dim vbResponse
>
> 'stop the error messages
> Response = acDataErrContinue
> 'used in message to user
> strListType = "Manager's Titles"
> strMsg = "Value Not In List!" & vbNewLine & vbNewLine
> & "The value you entered, """ & NewData & """, is not " _
> & "in the list." & vbNewLine & vbNewLine & "Do you
> want to add the value """ & NewData & """" & vbNewLine
> & "to the list of """ & strListType & """?"
> vbResponse = MsgBox(strMsg, vbInformation +
> vbDefaultButton1 + vbYesNo, "Add New List Value?")
> If vbResponse = vbYes Then
> DoCmd.OpenForm "frmManagersTitles", acNormal, , ,
> acFormAdd
> 'here I turn off the navigation button so the user
> 'cannot move off the new record
> Forms![frmManagersTitles].NavigationButtons = False
> 'place the new value in the text box on the form
> With Forms!frmManagersTitles.txtManagerTitle
> 'the "NewData" variable comes from the OnNotInList
> ' event and is provided when the event fires
> .Value = NewData
> .SetFocus
> End With
> End If
> End Sub
>
> HTH
> Byron
> >-----Original Message-----
> >Hi,
> >I'm trying to open a form when data is not in list. This
> form would allow me to format the missing field precisely
> before adding it. However, whatever I do, Access always
> gives me the "OpenForm event cancelled" when I try to open
> my input form, because Access is trying to make me choose
> from the drop down list just as I'm trying to open the
> form.
> >Is there a way to stop Access from trying to add the new
> item in the drop down list before I display my form and
> input the new data?
> >Thanks
> >.
> >
>



Relevant Pages

  • Re: Command to numerically solve
    ... These are the differences to the built-in GUI-Solver: ... 'EQ' can contain a list which contains the equation and a string ... that will be used as the title of the input form (Example: ... If the font is changed while GUISLV is already running (through ...
    (comp.sys.hp48)
  • RE: Message Yes/No to proceede to next record or close form
    ... Dim strMsg As String ... Dim vbResponse ... The name of my 0 tab stop control is Dot Number ...
    (microsoft.public.access.forms)
  • Re: HP50g Numerical Solver Number Format Setup
    ... 'EQ' may contain a list which contains the equation and a string ... that will be used as the title of the input form (Example: ... If 'EQ' contains the arguments described above the cursor is ... Hardkey - solves for all unknown variables ...
    (comp.sys.hp48)
  • RE: Message Yes/No to proceede to next record or close form
    ... Dim strMsg as String ... Dim vbResponse ... Doctor Access Downloads Page: ...
    (microsoft.public.access.forms)
  • Open form On not in list
    ... Dim strMsg As String, strFName As String, strLname As ... String, strListType As String ... Dim vbResponse ... my input form, because Access is trying to make me choose ...
    (microsoft.public.access.modulesdaovba)