Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Apr 2001
    Location
    Naperville, Illinois, USA
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Forms & Filters (A2K)

    I have a table / form for Customers. Within the form is a subform that shows various projects as a Continous Form. By clicking on a Command Button on a particular Project row, a full form is opened up for that project / customer and the Customer form is closed. The problem I am having is that when I want to return to the Customer form, I open the firm using the CustTBLID as the criteria.

    stLinkCriteria = "[CustTblID]= " & Me.CustomerID
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    The form opens correctly for that customer but is in a 'filtered' condition and only shows that one customer. If I try to remove the filter after the form loads, it wants to go to the first record in the table.

    Any suggestions? Is there a better way to open / close forms as the USer moves thru the system?

    Thanks in advance,

    Alan

  2. #2
    Star Lounger
    Join Date
    Apr 2001
    Location
    Naperville, Illinois, USA
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Forms & Filters (A2K)

    Thanks! That works great. The reason I don't just hide (or even minimize) the parent form is that the user could go to another form. This way I don't have to worry about any forms hanging around.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Forms & Filters (A2K)

    Why not hide the Customers form when you open the full form (by setting its Visible property to False) and unhide it when you want to return?

    Alternatively, pass the criteria as OpenArgs argument:

    DoCmd.OpenForm FormName:=stDocName, OpenArgs:=stLinkCriteria

    and use this in the On Load event of the Customers form:

    Private Sub Form_Load()
    If Not IsNull(Me.OpenArgs) Then
    Dim rs As Object
    Set rs = Me.Recordset.Clone
    rs.FindFirst Me.OpenArgs
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark
    Set rs = Nothing
    End If
    End Sub

    This will find the customer record instead of filtering the customer.

Posting Permissions

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