Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Posts
    4

    Question Unanswered: Help with disabling numbers in a combobox

    I have a table called CarPark Details, which has a field called "Bay No" which shows up in a form as a comboxbox and the user selects a Bay No. What I am trying to achieve is when the form opens that the numbers that have already been allocated in the Bay No list are not able to be selected again.

    eg: In my table I have Bay No - "1" already allocated to a membership.
    When the CarPark Details form opens, and I go to Bay No to select a number for a new membership that Bay No - "1" should not be able to be selected from the list of numbers. eg: it is "greyed" out or something to that effect.

    Can anyone offer me some help as I need it!!!!!!!

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    you don't say how the db "knows" that a bay is already allocated so i can only guess how you might be doing this.

    prehaps you have...

    tblBays:
    BayNo, integer, PK
    IDmember, long, FK to tblMembers

    tblMembers:
    IDmember, auto, PK
    name etc etc etc etc etc

    if you have something like this, then feed your combo with
    SELECT * FROM tblBays WHERE IDmember IS NULL;
    and only unallocated bays will be listed.

    if you want the greyed-out stuff then do some searching on "conditional formatting" (this might be helpful) ...the downside here is that the conditional format does not apply to the combo when it is dropped down for selection, but only when a value is selected.

    izy
    Last edited by izyrider; 01-09-05 at 05:30. Reason: typo
    currently using SS 2008R2

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Depending on your expertese in VBA....
    As an alternative consider using 2 combo boxes in the forms footer (or form detail if its a single row form - it won't work with a continous forms).
    One lists all bays occupied the other lits all bays free, similar to the report designer column/field selector. Allow selection of a bay in either combo box and then trigger what ever action you want to achieve. IE allocate or deallocate bay.

    You can populate the list boxes using 2 similar SQL statements. The first
    "SELECT * FROM tblBays WHERE IDmember IS NULL;" for free bays
    and
    "SELECT * FROM tblBays WHERE IDmember IS NOT NULL;" for occupied bays

    place a call to refresh the comboboxes (say in a function) in the forms "on current" event and "after update" event.

    It is a bit fiddly to set up, you are working with the combo boxes selected items. I wouldn't reccomend it for a novice developer (you would need some expertese with VBA) but it does provide a very clean interface which many users of windows applications would be familiar with.

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    This is strongly dependant on your table schema. How do you manage what bays are available?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

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