• Blank out a cbo text box (Access 2002/SP2)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Blank out a cbo text box (Access 2002/SP2)

    Author
    Topic
    #388334

    I am using one single combo box to display two different drop down lists. I do this by alternately assigning to its RowSource two different SQL statements, and then issuing the Dropdown method. It works fine. The problem is that as each dropdown list opens up, the cbo’s text box continues to display the selection from the previous dropdown list making a confusing looking picture.

    I would like the cbo’s text box to be blanked out as each succeeding list is opened. I have tried assigning a zero length string to the cbo’s Value and Text properties in both its Entry and BeforeUpdate events but in all cases received the illogical error message “Run-Time error ‘2115’: The macro or function set to the BeforeUpdate or ValidationRule property for this field is preventing (Access) from saving the data in the field.”

    Is there a way to blank out the cbo’s text box when dropping down a new list?

    Thanks.

    Viewing 0 reply threads
    Author
    Replies
    • #681365

      Have you tried just cbo = Null (where cbo is the name of the combo box) in the code that switches the row source?

      • #681374

        Hans,
        I put quote Me!cboName = Null unquote immediately in front of the RowSource assignment and Dropdown statements. I received the exact same error message as I reported above.

        Thanks, John

        • #681379

          I don’t understand why this happens – it works ok in my test. Perhaps other settings interfere. Try placing Me!cboName = Null after the statement that changes the RowSource.

          • #681427

            Sorry, same error message.

            John

            • #681433

              Try posting a zipped version of your database if all fails today.

            • #681529

              Yesterday the Null assignment was generating the error shown (It really was). Today it’s working as it should. I didn’t even re-boot. I’m confused. But, thank you for getting me where I am. (Now if I can just stay here.)

              John

            • #681569

              Like making an appointment with your dentist because you’ve got a toothache. It’s vanished when you get there… grin

            • #681686

              Don’t know if this is relevant, but I’ve had this happen with Queries and the odd form, had you saved the changes before trying them out??

              I’ve noticed that in certain circumstances the changes are not applied if you haven’t saved the form / query.

              Possibly not the reason, but it confused me for ages before I realised.

    Viewing 0 reply threads
    Reply To: Blank out a cbo text box (Access 2002/SP2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: