Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2006
    Posts
    559

    Unanswered: Case statement questions...

    I designed the DB and the forms. The control / field on the form that I'm trying to make the case statement off of is a combo box with 4 options in it, labeled "ActivityID".

    If I have a flowchart for 'select 1 and xyz', 'select 2 and wxz', etc, etc. Can I use the PK (ActivityID) to run this case? Like

    Select Case Me!optCases

    Case ActivityID = 1
    Me!Text1.Enabled = True
    Me!Text2.Enabled = False
    Case ActivityID = 2
    Me!Text1.Enabled = False
    Me!Text2.Enabled = True
    Case ActivityID = 3
    Me!Text1.Enabled = True
    Me!Text2.Enabled = True
    Case ActivityID = 4
    Me!Text1.Enabled = False
    Me!Text2.Enabled = False
    End Select

    The thing that I'm not sure about is how to put it to the specific combo box (ActivityID) so that when the user selects 1-4, specific items are able to be filled in or not filled in.

    AND I'm not sure where to put it on the form. I was thinking making ALL controls on the form disabled except the ActivityID combo box and when the user selects a specific instance, one of the above cases would happen depending on what they selected.

    Does anyone have any ideas that'll help me go in the right direction? Can anyone assist me with this?

    Thanks in advance.

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    I don't understand what the problem is. You seem to be doing what is required......
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Aug 2006
    Posts
    559
    I just wanted to make sure that I was going in the right direction.

    I was going to try to put on the "Before Update" event on the ActivityID combobox to make NO other controls active until the user selects one of the four choices.

    What's the easiest way to do that? Please don't say another case!

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    you may want to palce some code in the forms on current event to setup how the controls should be before they make a selection (ie disable any control they shouldn't have access to

    then in the combos on click event take the appropriate action

    bear ion mind one of the drivers behind usig a GUI is that you let the users do what they want at their own pace, inder certain limitations. if a control is enabled then it should be legitimate for the user topalce some values there, if its disabled then they can't.

    you will also need to take appropriate action if they decide to re click the comonb

    say the chage from option 3 to option 4 then I'd suspect you'd probably want to delete/remove anything in text1 & Text2.

    whilst we are talking of user interface issues I suspect a better choice may be a radio button rather than a combo box, but as ever its your app, your choices.....
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Aug 2006
    Posts
    559
    Quote Originally Posted by healdem
    you may want to palce some code in the forms on current event to setup how the controls should be before they make a selection (ie disable any control they shouldn't have access to

    then in the combos on click event take the appropriate action

    bear ion mind one of the drivers behind usig a GUI is that you let the users do what they want at their own pace, inder certain limitations. if a control is enabled then it should be legitimate for the user topalce some values there, if its disabled then they can't.

    you will also need to take appropriate action if they decide to re click the comonb

    say the chage from option 3 to option 4 then I'd suspect you'd probably want to delete/remove anything in text1 & Text2.

    whilst we are talking of user interface issues I suspect a better choice may be a radio button rather than a combo box, but as ever its your app, your choices.....

    Ok, you just made this much harder for me! Just playing! You're ideas are great. Thanks for putting them up there. I'm going to look into them.

    Right now, I have my Case Statement done but I'm getting an error of "Object doesn't support property or method", on the date fields. The code looks like the below, though it has 4 instances:

    Code:
    Me!CollectionID.Enabled = False
    	Me!Case_ID.Enabled = True
    	Me!Class_ID.Enabled = True
    	Me!Agency_Contacted.Enabled = True
    	Me!List62.Enabled = True
    	Me!SAC_Brief.Enabled = True
    	Me!SAC_Brief_Date.Enabled = True
    	Me!SAC_Reply.Enabled = True
    	Me!SAC_Reply_Date.Enabled = True
    	ME!Aware.Enabled = True
    	Me!EC_Drafted.Enabled = True
    	Me!EC_Draft_Date.Enabled = True
    	Me!Coordinate.Enabled = True
    	Me!General_Notes = True
    Anyone have a clue? I googled it and can't find any answers on it. Before it frustrates me, I think I'm going to work on other things that you have suggested. Please let me know if there is anything I'm missing referencing that case error?

Posting Permissions

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