RE: Open form On not in list
From: audreybmorin (audreybmorin_at_discussions.microsoft.com)
Date: 06/29/04
- Next message: Ken Snell: "Re: Field cannot be updated"
- Previous message: Don: "Getting the value of a dynamically modified Jet registry values"
- In reply to: Byron: "Open form On not in list"
- Messages sorted by: [ date ] [ thread ]
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
> >.
> >
>
- Next message: Ken Snell: "Re: Field cannot be updated"
- Previous message: Don: "Getting the value of a dynamically modified Jet registry values"
- In reply to: Byron: "Open form On not in list"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|