Results 1 to 8 of 8
  1. #1
    Richie27 is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Feb 2012
    Location
    Ireland
    Posts
    159

    Post Set Combo box values on form load to Please Select

    I have three combos. The first is populated by a query, the second based on the first and the third on the second.



    I want them all to say - Please Select when the form activates/loads. I tried this and it works for the first one but not the second two. Hmmm.. all are spelled fine (Checked about 5 times). Hmm, bit of a head scratcher.........

    Any inspiration would be wonderful!

    Private Sub Form_Activate()

    cboCostCentre.Value = "<Please Select>"
    cboCatDesc.Value = "<Please Select>"
    cboCentreCostDesc.Value = "<Please Select>"


    End Sub


    Thanks in advance!

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    I tried your code in both the Form Load and the On Activate events - and it worked fine in both places.
    Do you have any code in any of the combo boxes - especially the first one?
    Only thing I can think of is that once the first one is done - an event [like 'On Change' . . . or 'After Update'] is triggered and the other two cannot be filled.
    Do you have code behind the Combo boxes?

    For my test - I created a new Form & threw 3 combo boxes in there and put your code into the two events.
    Those combo boxes on my form don't DO anything else . . .

  3. #3
    Richie27 is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Feb 2012
    Location
    Ireland
    Posts
    159
    Quote Originally Posted by Robeen View Post
    I tried your code in both the Form Load and the On Activate events - and it worked fine in both places.
    Do you have any code in any of the combo boxes - especially the first one?
    Only thing I can think of is that once the first one is done - an event [like 'On Change' . . . or 'After Update'] is triggered and the other two cannot be filled.
    Do you have code behind the Combo boxes?

    For my test - I created a new Form & threw 3 combo boxes in there and put your code into the two events.
    Those combo boxes on my form don't DO anything else . . .
    Thanks for reply.

    Ah yes, I make the second combo requery when the first one is changed. Hmmm......... I need to make the second and third say <Please Select> though. Hmmmm......

  4. #4
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    You could try using the 'default Value' property of the combo boxes . . . however, you can only put "Please Select" in them if the data they are supposed to display is text data type.
    If the combo boxes are for Dates or Numeric . . . you'll get an error in it when the Form Loads.

    I remember in a VB.Net project putting the value that I wanted showing on top - in the table itself . . .
    Again . . . that is only an option if the data type of the data that the combo box will allow text.

    Or . . . you could have Labels above the boxes that say "Please Select" . . . ???

  5. #5
    Richie27 is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Feb 2012
    Location
    Ireland
    Posts
    159
    Hmmm... Well I am storing numbers but displaying the text. I have previously put the values in tables but can't help but feel it is a bit hackish, evil and a violation of proper normalization practices! I think in php you can set the default value prior to displaying your 'real' data. There must be a way of doing it in vba? Thanks for your suggestions, I may use one, though I am a little obssessed with finding a solution...hmmmm, may be why I struggle with deadlines!

  6. #6
    Richie27 is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Feb 2012
    Location
    Ireland
    Posts
    159
    Quote Originally Posted by Robeen View Post
    You could try using the 'default Value' property of the combo boxes . . . however, you can only put "Please Select" in them if the data they are supposed to display is text data type.
    If the combo boxes are for Dates or Numeric . . . you'll get an error in it when the Form Loads.

    I remember in a VB.Net project putting the value that I wanted showing on top - in the table itself . . .
    Again . . . that is only an option if the data type of the data that the combo box will allow text.

    Or . . . you could have Labels above the boxes that say "Please Select" . . . ???
    Thanks again. After many hours of my head being wrecked I have decided to go with a simple label.

    Thanks Robeen, should have taken your advice in the first place!

  7. #7
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    I wish you could have got exactly the solution you needed, and it MAY be possible . . . but I don't know how to do it.

  8. #8
    Richie27 is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Feb 2012
    Location
    Ireland
    Posts
    159
    Ah sure, there's no use getting bogged down with trifles. Things will never get done that way!! I'll look at it again if requested to do so (which I probably won't be)

    Thanks again - any and all help and suggestions are always much appreciated.

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

Similar Threads

  1. Cannot select values in combo box
    By EMeitz in forum Forms
    Replies: 3
    Last Post: 08-27-2011, 12:48 AM
  2. Replies: 3
    Last Post: 05-05-2011, 09:33 AM
  3. Replies: 1
    Last Post: 05-05-2011, 09:21 AM
  4. Replies: 1
    Last Post: 02-16-2011, 11:40 AM
  5. Replies: 5
    Last Post: 11-02-2010, 10:41 AM

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