Solved NotInList Problem (1 Viewer)

Josef P.

Well-known member
Local time
Today, 09:14
Joined
Feb 2, 2023
Messages
826
All filter values can be retrieved with FilterValues.
=>
Code:
Private Sub InsertAndSelectNewProject()

   Dim LastFilterValue As String
   With m_CbxFilterControl.FilterValues
      If .Count > 0 Then
         LastFilterValue = .Item(.Count)
      End If
   End With

   DoCmd.OpenForm FormName:="NewProject", WindowMode:=acDialog, Datamode:=acFormAdd, OpenArgs:=LastFilterValue
   m_CbxFilterControl.DeactivateSearchMode
   With Me.cbxSelection
      .Requery
      .Value = TempVars("NewProjectID").Value
      TempVars("NewProjectID").Value = Null
   End With
 
End Sub

Your variant with m_CbxFilterControl.TextValue is more charming.
Code:
DoCmd.OpenForm FormName:="NewProject", WindowMode:=acDialog, Datamode:=acFormAdd, OpenArgs:=m_CbxFilterControl.LastFilterValue
=> + Returns null or vbNullstring if nothing was entered.


the form must not be DataEntry.
DataEntry fits because the form is called "NewProject". ;-)
 
Last edited:

Users who are viewing this thread

Top Bottom