Results 1 to 4 of 4
  1. #1
    Raveen1609 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Dec 2019
    Posts
    53

    Combo box value enable or disable

    Hi. I have a scenario like below in my Event booking access form.

    Following are the fields in the form. Date, EventID, EventName, cost.

    I have 2 values, (Event1 & Event2) in Field EventName as ComboBox. When a customer book Event1 for the day, then I want the Event2 to be disabled for the same date. And next customers should be allowed to book only Event1. The same goes for Event2. (If the 1st customer book Event2, event1 should be disabled and rest of the customers are only allowed to book event2 for the date. I kindly request a solution for this scenario, VBA code or anyother options. Thanks

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,115
    I assume your combo is based on a table listing the events to choose from (lets say tblEventList) and you have another scheduling table listing the customer ids, event id (from the first table) and event date, lets name it tblEventSchedule. You need to modify the row source of the combo by joining in the scheduling table and adding to the criteria row to only show the EventID and EventName Where dCount("*","tblEventSchedule","EventDate=#" & Forms!frmYourForm!EventDate & "#")>0; save this as a query named qrySelectedEventForSelectedDate or something similar. And finally in the Enter or GotFocus event of the combo have:
    Code:
    if dCount("*","qrySelectedEventForSelectedDate")>0
        Me.cboEventList.RowSource="qrySelectedEventForSelectedDate" 'first event already selected
    Else
       Me.cboEventList.RowSource="tblEventList" 'no selection yet
    End If
    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    to answer your question we need to see the table structure and relationships that relate to your question plus the rowsource of your combo.

    Would also help to see some example data and the outcome you require from that example data since your description is not clear. You seem to be saying you can only run one event on any given day and whoever is the first customer to book either event1 or event2 for a particular day decides which event occurs on that day.

    Also not clear - are you providing available dates for either event 1 or event 2, or can a customer choose a date at random in the past or future any day of the week or weekend? (appreciate in the past is unlikely, but not specified)

    And is there a limit on how many customers can attend an event

  4. #4
    Raveen1609 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Dec 2019
    Posts
    53
    thanks very mcuh

    You are absolutely right on the 2nd paragraph

    This is an itemtable with eventname, eventid. The row source is from Eventname. The relationship is itemid with itemID in bookingdetails table where the Bookingdate field is there along with customername etc..

    Customer can select any date at random, for future only. No limit for customers attendance.

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

Similar Threads

  1. Disable And Enable
    By Perfac in forum Access
    Replies: 2
    Last Post: 07-01-2022, 03:35 PM
  2. Enable/disable control
    By skydivetom in forum Forms
    Replies: 2
    Last Post: 02-26-2020, 05:12 AM
  3. Enable/Disable Button
    By P.Malius in forum Programming
    Replies: 3
    Last Post: 09-07-2012, 08:36 AM
  4. Replies: 1
    Last Post: 02-25-2011, 10:03 AM
  5. Replies: 3
    Last Post: 09-29-2010, 09:31 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