Results 1 to 4 of 4
  1. #1
    Oblio is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    50

    Question Form Open/Load Event sets bound combobox value

    I have a table named t_tests:

    tests_ID PK autonumber
    Test_Types_ID FK (only two choices: Test Type A or B )

    The only difference between Test A or B type is that the written score for Test Type A is divided by 200, while Test Type B is only divided by 100.

    Rather than create to separate tables for the test types, I created one table and made a calculated field in the table: IIf([Course_Test_Types_ID]=1,[Written Test Score]/200*100,[Written Test Score]/100*100)

    I created two forms: both bound to the same table (t_Tests) with one form based on Test Type A selected, the other based on Test Type B.

    I would like to set the value of the combobox for the Test Type = Test Type A if it is the A form, or B if it is the B form in the forms Open or On Load Event so that there is no error if the forget to choose the Test Type correctly. Any advice on this would be greatly appreciated... I am not sure if what I am doing is sensible or not and if it is sensible is this the best way to accomplish this?
    Regardless, I would like to know how to set a bound combobox value on a form when the form loads.

    Thank you for any help and advice with this !!!!



    William

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    My $0.02.......

    First thing I would do is delete the calculated fields out of the table. They will only cause you problems.

    Next, I would use one form - with two forms you have twice the maintenance. If, next week, you want to modify Form A, don't forget to modify Form B.

    With one form, you can use the form before update event to check if the TestType combo box has a value. If it doesn't , stop the save and tell them to select a test type - set the focus to the combo box.

    The calculation: IIf([Course_Test_Types_ID]=1,[Written Test Score]/200*100,[Written Test Score]/100*100)
    should be done in a query for a form/report.


    Also, save yourself some headaches - DO NOT use spaces in object names - any object! Object names: fields, tables, queries, forms or reports.


    As I said, these are my opinions....

  3. #3
    Oblio is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    50
    I think those are excellent points, Steve, thank you!

    The two forms, while practically identical, have strong visual colour and picture clues as to whether or not they are using a Type A form or a Type B form.

    Is the illusion of two forms possible? I am thinking it would be the same form, just named "Type A Form Green" and "Type B Form Red" so that I only have to maintain one form as you suggested. The header Picture and Text would appear green or red depending on which "separate" form they chose... I am thinking I could have both Red and Green Headers and change between them with a "IIf type visible" depending on which form they open... does this seem doable in your opinion?

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Sure. Set up so that the first thing that hast to/must be done is to select Form A/Form B from the combo box. The colors would be set accordingly.


    The two forms, while practically identical, have strong visual colour and picture clues as to whether or not they are using a Type A form or a Type B form.
    Excellent thing to do. I did that in an Access safety permit system. There were 3 identical production facilities, so the 1st had a blue theme, the 2nd had an orange theme and the 3rd had a green theme. Then the controls were centralized (computerized - aka a DCS system). The graphic control displays for each facility were matched to the same respective color schemes.


    I am thinking I could have both Red and Green Headers and change between them with a "IIf type visible" depending on which form they open... does this seem doable in your opinion?
    Or you could set the background color depending on the "Form" selected (A/B). "Change between them" means hide or make them visible??

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

Similar Threads

  1. form on load event
    By vicsaccess in forum Programming
    Replies: 2
    Last Post: 01-13-2016, 11:33 PM
  2. Replies: 13
    Last Post: 09-10-2015, 03:37 PM
  3. Replies: 1
    Last Post: 01-16-2015, 09:28 AM
  4. Replies: 1
    Last Post: 03-29-2014, 07:46 PM
  5. Bound form with bound combobox
    By Jerry8989 in forum Access
    Replies: 2
    Last Post: 12-05-2011, 01:50 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