Results 1 to 6 of 6
  1. #1
    kc1 is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2011
    Posts
    5

    Question Update combo box from recordset

    Hi



    I need help as I can't seem to find a solution anywhere.

    I have written code to retrieve data from a back-end, that is then bound to a form (late binding forms).
    From the retrieved record set I want to update a combo box using 1 field from the data in the record set, only showing unique records in the list.

    Please could someone help me with this?

    Thanks

    KC

  2. #2
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    Is you problem in linking with the combobox or in finding unique

    records?

    Are you familiar with DISTINCTROW?
    http://office.microsoft.com/en-us/ac...001231351.aspx

    If you are struggling with the combobox, can you be more specific?

    Quote Originally Posted by kc1 View Post
    Hi

    I need help as I can't seem to find a solution anywhere.

    I have written code to retrieve data from a back-end, that is then bound to a form (late binding forms).
    From the retrieved record set I want to update a combo box using 1 field from the data in the record set, only showing unique records in the list.

    Please could someone help me with this?

    Thanks

    KC

  3. #3
    kc1 is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2011
    Posts
    5
    Yeah, I'm familiar with Disticnt.
    This is what currently happens, when an unbound form and subform are opened, event code is run that bounds a record set to the subform, this record set is from the back end database.
    On the form there is a combo box, I want this combo box to be populated with unique values from 'Field1' from the record set now bound in the subform.
    Where is this record set stored and can I keep using it for such actions?
    Perhaps I should just append this record set to a table and use that to determine the combo box values. (how, I don't know either?)

  4. #4
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    For the event code to bind a record set to a sub form, the event code

    would have the recordset pointer, which should suffice to set the Combobox recordsource. Since the subform event code has the pointer, this code should probably set the recordsource.
    After binding, does the event code do a "Me.requery"? You should have the combobox set before the requery, or you may have to execute another requery.

    Quote Originally Posted by kc1 View Post
    Yeah, I'm familiar with Disticnt.
    This is what currently happens, when an unbound form and subform are opened, event code is run that bounds a record set to the subform, this record set is from the back end database.
    On the form there is a combo box, I want this combo box to be populated with unique values from 'Field1' from the record set now bound in the subform.
    Where is this record set stored and can I keep using it for such actions?
    I don't think the recordset's location is important. You should be able to use the recordset until it is closed. Do you know where or when the recordset is opened or closed? Is it a global variable?
    Perhaps I should just append this record set to a table and use that to determine the combo box values. (how, I don't know either?)
    This shouldn't be necessary.

  5. #5
    kc1 is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2011
    Posts
    5
    I know where I open and close the record set, and it's global.
    I take it I need to the update to combo box before I close the recordset- but I need help with the exact coding.
    Could you provide this for me please?

  6. #6
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481

    Conceptually, writing code without knowing anything about your objects

    should be easy. However, I doubt that my effort in that direction would be of much help.
    Can you remove any confidential info from your database, compact it, zip it if necessary and post it.

    Quote Originally Posted by kc1 View Post
    I know where I open and close the record set, and it's global.
    I take it I need to the update to combo box before I close the recordset- but I need help with the exact coding. I believe the recordset would have to remain open for as long as the combobox is functional. If this is a problem, then perhaps you will have to create a local table.
    Could you provide this for me please?

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

Similar Threads

  1. Replies: 6
    Last Post: 12-01-2011, 10:54 AM
  2. Replies: 3
    Last Post: 08-03-2010, 02:24 PM
  3. Replies: 1
    Last Post: 07-17-2010, 08:55 PM
  4. Replies: 1
    Last Post: 11-13-2009, 03:03 AM
  5. Replies: 2
    Last Post: 10-01-2009, 03:39 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
  •  
Other Forums: Microsoft Office Forums