Results 1 to 9 of 9
  1. #1
    3 Star Lounger
    Join Date
    May 2002
    Location
    Florence, Oregon, USA
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

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

    Have you tried just <font face="Georgia">cbo = Null</font face=georgia> (where cbo is the name of the combo box) in the code that switches the row source?

  3. #3
    3 Star Lounger
    Join Date
    May 2002
    Location
    Florence, Oregon, USA
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

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

    I don't understand why this happens - it works ok in my test. Perhaps other settings interfere. Try placing <font face="Georgia">Me!cboName = Null</font face=georgia> after the statement that changes the RowSource.

  5. #5
    3 Star Lounger
    Join Date
    May 2002
    Location
    Florence, Oregon, USA
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    Sorry, same error message.

    John

  6. #6
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

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

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

  7. #7
    3 Star Lounger
    Join Date
    May 2002
    Location
    Florence, Oregon, USA
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

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

    Like making an appointment with your dentist because you've got a toothache. It's vanished when you get there... <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

  9. #9
    3 Star Lounger
    Join Date
    Oct 2001
    Location
    Newport, Gwent, Wales
    Posts
    257
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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.

Posting Permissions

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