Results 1 to 5 of 5
  1. #1
    TesZero is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2014
    Location
    Portugal
    Posts
    5

    Change Combobox list after use it

    Hello.



    I am doing a checklist database.

    With some other data, i have a field called "Local". (combobox)

    In that "Local" field i must select the place where the checklist is made.

    So, i have 20 places to do checklists, and when i select one place and save the check list, i need that "local" is disable from my combobox list so i dont accidentally repeat it.

    My combobox is based in a table query.

    I must do 2 checklists per day for each those 20 places...

    And i cant figure out how to remove those items after use them at the moarning... and have them avaible again in the afternoon.

    Thanks for your attention in advance, hope someone can help me

    Regards
    Pedro SIlva
    Portugal.

  2. #2
    amrut is offline Expert
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Dubai
    Posts
    614
    I don't think one can disable a single item in a combo box.
    Options -
    1.You can disable the combobox
    2.Use the before update event of the combo box to compare it with the existing value
    3. Use criteria to filter out the selected place when you press the save button, so it doesn't appear in the list ( Not an option for bound field)

  3. #3
    thebigthing313 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2014
    Posts
    119
    Some ideas I can come up with:

    1) Before saving a checklist, check if the "Local" field value was used in the previous 20 checklists.
    2) Recording what time a checklist was made, and having your combobox RowSource only have values that weren't used in the past 8 hours, or whatever time frame you decide.

    Either solution is doable, but may be complex depending on your skill level.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    First need a dataset of all possible combinations of places and check dates.

    SELECT DISTINCT Place.PlacesTable, DateField.DataTable FROM PlacesTable, DataTable;

    Then join that query to the data table.

    SELECT Query1.Place
    FROM Query1 LEFT JOIN DataTable ON (Query1.DateField = DataTable.DateField) AND (Query1.Place = DataTable.Place)
    WHERE (((Query1.DateField)=Date()) AND ((DataTable.Place) Is Null));

    Running checks twice a day is more complicated. Easiest approach might be with another field to indicate the run is AM or PM.

    SELECT DISTINCT Place.PlacesTable, DateField.DataTable, DayPart.DataTable FROM PlacesTable, DataTable;

    SELECT Query1.Place
    FROM Query1 LEFT JOIN DataTable ON (Query1.DayPart = DataTable.DayPart) AND (Query1.DateField = DataTable.DateField) AND (Query1.Place = DataTable.Place)
    WHERE (((DataTable.Place) Is Null) AND ((Query1.DateField)=Date()) AND ((Query1.DayPart)=IIf(DatePart("h",Now())<12,"AM", "PM")) AND ((DataTable.Place) Is Null));
    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
    TesZero is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2014
    Location
    Portugal
    Posts
    5
    Hello, first of all, thank you very much for your answers.

    I solved my problem, maybe not in the right way, but it is working fine

    So... what i done was:

    I created a table with ID, Local_name, Shift1, Shift2, Shift3

    then, i created a continues form with this table fields.

    When i open my main form, and after select the Local in my combobox, my combobox open the Local_Form hidden, it makes a filter by local_name and depending the time it writes a "1" in the correct shift for the local_name.
    After it, my combobox query (show all exept the "1" field" is refreshed
    If the swift changes, it writes "0" in all fields so we can select all local_name again.

    I should do it without opening a hidden form, writing directly in the table... but it is working fine and i have a lot of work to do...
    i need to migrate all of this to .Net in the future, so for now... it is fine and working.

    If someone needs to do it and need help, i can try to explain it better and with printscreens.

    Regards,
    Thank you for all,
    Pedro Silva

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

Similar Threads

  1. Change of Combobox value changes Table record ..
    By PlamenGo in forum Programming
    Replies: 1
    Last Post: 04-15-2014, 06:42 AM
  2. Refresh / Requry Subform Upon Combobox Change
    By michael.legge@rbc.com in forum Access
    Replies: 3
    Last Post: 06-18-2013, 06:28 AM
  3. Programming to change Combobox to Textbox on the fly
    By shane201980 in forum Programming
    Replies: 3
    Last Post: 09-05-2012, 10:05 PM
  4. change a combobox value depending on another
    By emadaldin in forum Access
    Replies: 3
    Last Post: 01-17-2011, 01:06 PM
  5. Replies: 1
    Last Post: 03-18-2009, 12:30 AM

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