Results 1 to 2 of 2
  1. #1
    ciruliz is offline Novice
    Windows XP Access 2007
    Join Date
    May 2010
    Posts
    1

    Combo box values for existing and new records

    Hello,
    I don't really know how to formulate question, so I will try to
    explain problem shortly:
    I have created small invoicing application in Access 2007 for renting
    business - there is table of customers, table of invoices and table of
    devices we offer for rent (there is one type of devices, total number
    - around 10)
    There is form for entering new customers and that form contains combo
    box, which is lookup to devices table - so user can pick one of
    devices.
    Everything works so far.
    I wanted to introduce new feature - when adding new customer, user can
    choose only from those devices which are not rented away. So I created
    subquery to limit values of combo box.
    Query looks like this:
    Code:
    SELECT Koncentratori.ID, Koncentratori.AccountingNumber 
    FROM Koncentratori 
    WHERE (((Koncentratori.ID) Not In (SELECT customers.ConcentratorID 
    FROM customers WHERE (((customers.agreementActive)=Yes)); ))) 
    ORDER BY Koncentratori.AccountingNumber;
    Koncentratori (Concentrators) is the mentioned table of devices, rest
    should be obvious.
    So far so good.
    But here comes the problem - after using this subquery, new record can
    be added nicely and combo box contains only those devices, which are
    not rented away. However for existing customers combo box does not
    show current value - as it is in conflict with that subquery.


    I am not sure how to overcome this problem, thanks for any advice!
    Br,
    Andis

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    My first thought is to create an "isAvailable" field in your Device table.
    Use whatever method you want to indicate it (yes/no, -1/0, whatever).
    Apply this to Devices already in use.
    Have your combox query be SELECT DeviceName FROM Device WHERE isAvailable = yes
    When a customer is created, have an update query run to set the isAvailable for that Device to 'no'.
    Requery your Form.

    I think that should fix your subquery conflict.

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

Similar Threads

  1. Replies: 1
    Last Post: 03-27-2010, 06:13 AM
  2. Combo Box without repeated values
    By SCFM in forum Access
    Replies: 2
    Last Post: 02-20-2010, 05:57 PM
  3. Replies: 1
    Last Post: 08-26-2009, 10:45 AM
  4. Change existing combo box to new one
    By snifferpro in forum Forms
    Replies: 3
    Last Post: 08-10-2009, 09:26 AM
  5. Replies: 3
    Last Post: 02-26-2009, 10:17 AM

Tags for this Thread

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