Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Join Date
    May 2004
    Location
    South Australia
    Posts
    39

    Unanswered: Refreshing Drop-Down Lists

    Hi peoples,

    I'm using (what I like to call) referenced drop-down lists to provide an 'auto-complete' feature. The problem I'm having is that once I've added, say, a new student, that student's ID won't show up in the listbox until I either reopen the form, or restart the whole database.
    (It seems to be random - I'm sure access is laughing at me behind my back )

    From reading other posts, I'm sure there's a way to force a refresh using an on_whatever command, but I can't work out how.
    Can anybody help me out here?
    Any alternate suggestions also welcome.

    Thanks,
    Frekster

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Did you try the Requery method of the ListBox

  3. #3
    Join Date
    May 2004
    Location
    South Australia
    Posts
    39
    Quote Originally Posted by hammbakka
    Did you try the Requery method of the ListBox
    Ummm... Where/How do I do that? Sorry if this is an obvious thing, but I'm new to this.

  4. #4
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    In the after Update event of your ListBox write
    Me.yourListField.Requery

    Example
    PHP Code:
      Private Sub list_Feld_Eindeutig_AfterUpdate()
        
    Me.yourListField.Requery
      End Sub 

  5. #5
    Join Date
    Feb 2004
    Location
    Colorado state
    Posts
    65
    hammbakka,
    Thanks for the info, I was having the same problem. Works like a champ!

    Mike

  6. #6
    Join Date
    May 2004
    Location
    South Australia
    Posts
    39

    Red face Working... sort of...

    Thanks hammbakka

    It works fine - almost. This is the code I used:

    PHP Code:
    Private Sub StudentID_AfterUpdate()
    Me.StudentID.Requery
    End Sub 
    It refreshes fine, but only after I've selected something else from the list.
    (ie. Change source field, No change in listbox, I select something else, look again and it's there)

    Is this how it's intended to work?
    If so, my apologies and thanks, because it does work great.
    If not, can you (or anyone else) see what I've done differently? My only clue is the
    "list_Feld_Eindeutig"
    in the code you gave me.
    Did I replace this correctly?

    Thanks for your time either way, it's greatly appreciated.

    Cheers,
    frekster

  7. #7
    Join Date
    Apr 2004
    Posts
    182
    is your list box called studentid ? if not the name of your listbox is what should be where you have studentid. ie if you called it lstStudentID then your code is
    Private Sub lstStudentID_AfterUpdate()
    Me.lstStudentID.Requery
    End Sub

  8. #8
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    If your list box is called StudentID then you did replace it right.

    Private Sub StudentID_AfterUpdate()
    Me.StudentID.Requery
    End Sub

  9. #9
    Join Date
    May 2004
    Location
    South Australia
    Posts
    39

    Checked that one...

    Quote Originally Posted by livvie
    is your list box called studentid ? if not the name of your listbox is what should be where you have studentid. ie if you called it lstStudentID then your code is
    Private Sub lstStudentID_AfterUpdate()
    Me.lstStudentID.Requery
    End Sub

    Yeah, it's called StudentID. It does work, just not in the way I thought it would. I'm attaching an example of what I'm doing so people can see what I mean.

    Thanks anyways,

    frekster
    Attached Files Attached Files
    Last edited by frekster22; 05-18-04 at 07:35. Reason: Spelling error

  10. #10
    Join Date
    Apr 2004
    Posts
    182
    How are you adding the new student ? From another form or using the table ?

  11. #11
    Join Date
    May 2004
    Location
    South Australia
    Posts
    39
    Quote Originally Posted by livvie
    How are you adding the new student ? From another form or using the table ?
    Well, I've tried both. In my actual database I've set up a form to enter the data, but in my example I just entered it though the original table. Both have the same effect/problem described above.

    I'm also curious - what exactly does the AfterUpdate check for? I'm wondering if it needs something to prompt it into action...?

    Anyways, I'm going to sleep on it. I'll give it another go tomorrow in IT.

    Thanks for all your suggestions,
    frekster

  12. #12
    Join Date
    Apr 2004
    Posts
    182
    The AfterUpdate event on the combobox means after the combobox has been updated. You need to requery on some other event that occurs once you have saved the new student so maybe you should do it on the student entry form or try onclick in the studentid combo.

  13. #13
    Join Date
    May 2004
    Location
    Toronto
    Posts
    7

    Thumbs up This worked for me.

    This worked for me.

    Private Sub cboCentre_AfterUpdate()

    cboName.Requery
    [Forms]![New Bus Edits].[New Bus Edits subform].Requery
    cboClient.Requery
    End Sub


  14. #14
    Join Date
    May 2004
    Location
    South Australia
    Posts
    39
    Well, I tried the On_Focus, and it seems to work, I just have to click off, then on the listbox. An inconvenience, but better.
    On_Click doesn't work, as it's isn't a button (well, that's the only explanation I can think of. Doesn't explain why they put the option there though).
    I have no idea how to link a command from a different form - could someone help me with this? Unless that's what Nicelynicely's suggested?

    And Nicelynicely - thanks for the suggestion. I'll give it a shot as soon as I have time with my other homework.

    Thanks guys for all your help so far.

  15. #15
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004
    I d/l your listbox and can't figure out what the problem is. You only have that One field in it and you can select it. What else are you wanting it to do? As it stands it's just a StandAlone ListBox. Check back later...

    Bud

Posting Permissions

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