Results 1 to 5 of 5
  1. #1
    yohansetiawan is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    24

    Question Older record disappearing when filtered

    My database contain these:


    - Products Table = [ID].AutoNumber, [Product].Text, [Active].Yes/No
    - Orders Table = [ID].AutoNumber, [Product].Number, [Date].Date/Time, [Payment].Text
    - Orders Form = [ID], [Product], [Date], [Payment]

    I have [Product] in Orders Table and Orders Form as Combo Box for showing Product from Products Table.
    And within product field on Orders, I want to make 'Active' product only showing up when choosing from combo box.
    I made some records to test in Orders Form.
    Then I filtered Product from Orders Form with query:
    Code:
    SELECT Products.ID, Products.Product, Products.Active
    FROM Products
    WHERE (((Products.Active) Like Yes));
    Then I changed some product 'Active' to "No"
    And the old record disappearing.
    How to make older record not disappearing when I filter some of field not being available to choose (because Active product uncheck)

    more in-depth, I attached my database, have a look at it Database1.zip

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    That is the nature of comboboxes with filtered lookups. If you are going to review old orders that relate to inactive product record, can't be with a filtered combobox that excludes the inactive products. Could use VBA code to reset the combobox rowsource for orders with inactive product links.

    Try this:

    1. RecordSource of Orders: SELECT Orders.*, Products.Active FROM Products RIGHT JOIN Orders ON Products.ID = Orders.Product;

    2. Code in the OnCurrent event of the form:
    If Me!Active = No Then
    Me.Product.RowSource = "SELECT Products.ID, Products.Product, Products.Active FROM Products;"
    Else
    Me.Product.RowSource = "SELECT Products.ID, Products.Product, Products.Active FROM Products WHERE (((Products.Active) Like Yes));"
    End If
    Me.Product.Requery
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    yohansetiawan is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    24
    yes it works... but when I make datasheet type form, the code perform only when I clicked the row.. when that row (inactive product) not clicked, that row wouldn't display (like disappearing again)... maybe some code for datasheet form??

    I've attached them, have a look
    Attached Files Attached Files

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    Nope, that's what happens with datasheet. You can include the Product name field from Products table in the form for display in a textbox. Set textbox as Locked Yes and TabStop No.

    You have the wrong join type in the query. Look at my suggestion again.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    yohansetiawan is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2012
    Posts
    24
    thanks June7

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Create menu keeps disappearing
    By thart21 in forum Access
    Replies: 1
    Last Post: 12-18-2011, 01:59 AM
  2. Replies: 4
    Last Post: 06-15-2011, 03:55 AM
  3. The amazing disappearing VBA code
    By Michele Keck in forum Forms
    Replies: 2
    Last Post: 10-01-2010, 11:44 AM
  4. Stoping Times disappearing
    By AJH1984 in forum Access
    Replies: 10
    Last Post: 06-19-2009, 05:46 AM
  5. query date that is five years older than today
    By cpsummer in forum Queries
    Replies: 2
    Last Post: 09-26-2007, 02:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums