Results 1 to 3 of 3
  1. #1
    Saabra is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2019
    Posts
    4

    Sequential date fields - upon entering a date will force drop down selection

    Hi,
    I'm not the best at writing code, so whatever solution you provide will need to be dumbed-down.

    I'm in design phase of a small database that is capturing referrals to a hospital. There will be five date fields that need to follow a sequential order.

    1. Referral Recieved
    2. Referral in the cue for admission
    3a. Referral admitted to hospital or
    3b. Referral not admitted after being in the cue or
    3c. Referral denied

    There will be a "Referral Status" field, a drop-down, with the following choices:

    CONSIDERED FOR ADMISSION
    ADMITTED
    IN THE CUE BUT NOT ADMITTED
    DENIED

    When 2 is selected, I want the referral status field to select "CONSIDERED FOR ADMISSION"
    When 3a is selected, I want the field to show "ADMITTED"


    When 3b is selected, I want the field to show "IN THE CUE BUT NOT ADMITTED"
    When 3c is selected, I want the field to show "DENIED"


    How do I have the "Referral Status" field respond to dates entered in the status date fields? Can this be done in a query? Also, how can I enforce the sequential rule of the date fields? Lastly, how do I have the referral record disappear from the user's view if ADMITTED, IN THE CUE BUT NOT ADMITTED, or DENIED dates are entered?

    Thank you in advance for your help on this.
    Saabra

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Build a form bound to table and write code. Conditional Formatting can also help - text and combo boxes can be set Enabled/Disabled depending on whether another control has data.

    Status does not have to be a field in table. This can be calculated when needed. An expression in query or textbox like:

    =Switch(Not IsNull([Denied]),"Denied", Not IsNull([NotAdmittedAfter]),"IN THE CUE BUT NOT ADMITTED", Not IsNull([Admitted]), "ADMITTED", Not IsNull([InCue],"CONSIDERED FOR ADMISSION")

    Or write a VBA custom function that can be called from query or textbox.

    Records 'disappear' by applying filter criteria and refreshing the form. Form RecordSource could be a query like:

    SELECT * FROM tablename WHERE Not ADMITTED Is Null AND Not [IN THE CUE BUT NOT ADMITTED] Is Null AND Not DENIED Is Null;

    Code in control's AfterUpdate event would requery the form: Me.Requery

    Advise not to use spaces nor punctuation/special characters (underscore only exception) in naming convention. Nor ALLCAPS. CamelCase is easier to read.
    Last edited by June7; 04-15-2019 at 02:08 PM.
    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
    Saabra is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2019
    Posts
    4
    June7,
    I'll see what I can understand and do with your recommendation. Thanks so much for your help.
    Saabra

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

Similar Threads

  1. Replies: 1
    Last Post: 04-24-2018, 07:00 AM
  2. Replies: 2
    Last Post: 03-09-2016, 04:15 PM
  3. Entering Today's Date
    By Alex Motilal in forum Access
    Replies: 5
    Last Post: 08-23-2011, 12:22 AM
  4. Replies: 4
    Last Post: 07-27-2011, 12:42 PM
  5. Parameter Date - Force a Monday Date
    By ker9 in forum Queries
    Replies: 3
    Last Post: 07-26-2011, 01:06 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