Results 1 to 14 of 14
  1. #1
    jimmonator is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Portland, OR
    Posts
    26

    Combo Box defaults to Blank

    Okay, this looks like a bigger forum than where I originally posted thsi. My thread over there has stalled, and I still haven't solved it. I don't know wht the proper etiquette pr procedure is for this, so I will just put a link to it and see how that flies.



    http://www.access-programmers.co.uk/...d.php?t=208724

    Can ANYBODY figure this out? Why is my box blank?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,947
    I'm not clear on the goal. Are you trying to have the combo display a given value, or the form be opened to that record?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    jimmonator is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Portland, OR
    Posts
    26
    In this Patient Info form, I want the form to open with the Combo Box displaying the most recent record in the Donor_Letters table. Currently, you must click on the combo box in order to make it display. I just want one record displayed by default, others upon clicking.

    Thank you so much for your interest.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,947
    Can you post the db for testing?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    jimmonator is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Portland, OR
    Posts
    26

    Here is a copy

    Attached is a zip of the DB

    Thanks,

    Jim

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,947
    Well, if you take out the control source of that combo and the If statement out of the code, it will display the last date when it's opened.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    jimmonator is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Portland, OR
    Posts
    26
    Well, that didn't work either. The code I have was supplied by a pretty experienced poster in this other thread http://www.access-programmers.co.uk/...d.php?t=208724 and he explained why he did it that way, but it doesn't work. No matter what I do, that damn Combo46 comes up blank upon loading a record. I have been trying to make this work for a month now. I want to see the latest entry in that box, get a running list of records upon clicking, and upon selecting an item, see a subform displaying that record's contents. This doesn't SEEM like it should require any code at all, but what do I know? A copy of the DB is still available in my post above.

    Thanks in advance for any more ideas you might have on this problem.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,947
    Well, I had tested and it did work (defined as it did what I intended, which was to display the latest date). I understand what Bob was doing, but the NewRecord code is only required if the combo is bound. Since I unbound it, that test isn't required, and in fact prevents the combo from populating since the record on load isn't new.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    jimmonator is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Portland, OR
    Posts
    26
    Paul,
    It is quite possible that I did not do it properly. I am not at all conversant in this.

    By removing the items you mentioned from the code, it ended up looking like this:
    -------------------------------------
    Option Compare Database

    Private Sub List44_Click()
    End Sub
    Private Sub Form_Load()
    Me.Combo46 = DMax
    End Sub
    -----------------------------
    Is that what you intended?

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,947
    Well, that DMax() is incomplete. It didn't change, so mine looks like (I just commented out the test):

    Code:
    Private Sub Form_Load()
      'If Me.NewRecord Then
        Me.Combo46 = DMax("[Let_Date]", "Donor_Letters")
      'End If
    End Sub
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    jimmonator is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Portland, OR
    Posts
    26

    Error

    Paul,

    When I plug in that code i get an error, see attached screen shot

    Thanks,

    Jim

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,947
    Did you do this part:

    Quote Originally Posted by pbaldy View Post
    if you take out the control source of that combo
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  13. #13
    jimmonator is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Location
    Portland, OR
    Posts
    26
    Well, that seems to have done it. The frustrating thing is I have no idea why, or what I am doing! But it works, and thank you very much!

  14. #14
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    20,947
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Defaults Values Missing After DB Move
    By cbuechler in forum Database Design
    Replies: 2
    Last Post: 02-15-2011, 08:33 AM
  2. Combo box shows blank on opening the Form
    By Alex Motilal in forum Forms
    Replies: 7
    Last Post: 01-15-2010, 11:59 AM
  3. Blank Data to Combo
    By dlewicki in forum Access
    Replies: 10
    Last Post: 01-14-2010, 10:07 AM
  4. Blank combo boxes
    By ROBBO in forum Forms
    Replies: 3
    Last Post: 01-06-2010, 10:22 AM
  5. Replies: 1
    Last Post: 09-05-2008, 12:07 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
  •  
Tech Forums: Microsoft Office Forums