Results 1 to 10 of 10
  1. #1
    jplecaros is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2010
    Posts
    5

    Unhappy My combobox doesn´t update the selected value when I click on next record

    Hi, I have a table called Proyects. This table has an Id, name, and year.
    I made a form with the third option of the combobox wizard, for searching a record. So when I select a record throw the combobox, it displays all the info about that record. Until here, everything's ok.

    The problem is that when I click on next record (little arrow on the lower section of the Access screen, near the search box), the combo box doesn't select the new record.

    Aditional info:
    The form has 2 fields selected on Row Source: Id and name
    Control source is empty

    If I set the name field on control source, the names of the combo box star to change to the id numbers as I select them on the combobox. So after clicking on all the names of my combobox, my combobox displays only id numbers and not names.

    If I set the id field on the control source, I can´t select the records on the combobox, due Id is a primary key.

    I haven´t found any answer on the Internet
    What can I do, please help me.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    It all has to do with whether the ComboBox is bound or not. In order to use the cbo to look up records (by selecting #3 from the wizard) the cbo *cannot* be bound. In order for an unbound control to display data from a field in the RecordSource of the form, you need to take extra steps. You could use the CurrentEvent of the form to set the cbo to display what you want.

  3. #3
    jplecaros is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2010
    Posts
    5
    Thanks a lot for your help, the problem is I'm too new like for writting down such code.

    What could be an example of that code?? Sorry for stealing your time, thanks a lot!


    Private Sub Form_Current()

    End Sub

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What do you want the cbo to display? What is the RowSource of the cbo and to what is the Widths property set?

  5. #5
    jplecaros is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2010
    Posts
    5
    I need to display the name of the Proyects

    The row source is the Id of the proyects, and the name of the proyects, but I hide the first column, so I only see the name of the proyects on the cbo.

    The exact row source is in spanish and it is:

    SELECT [Proyectos].[Id], [Proyectos].[Nombre (Ciudad y Calle)] FROM Proyectos;

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Does the RecordSource of the form contain this field and if so what is the name of the field? [Proyects] perhaps?

  7. #7
    jplecaros is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2010
    Posts
    5
    It's [Proyectos], which means [Proyects]

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Okay, try something like:
    Code:
    Private Sub Form_Current()
       Me.ComboBoxName = [Proyectos]
    End Sub
    ...using *your* ComboBoxName of course.

  9. #9
    jplecaros is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2010
    Posts
    5
    I solved it!!!!!!!

    I created a title on the top of the form, which is a text box that displays the current record name. I tried to match the name of the title with the displayed cbo

    I tried:

    Private Sub Form_Current()
    Me.Proyectocbo = [Título]
    End Sub


    And it worked!!, thanks to your help, I couldn't have done that by my own.
    Thank you VERY much.

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Outstanding! Thanks for posting back with your success. Go ahead and use the Thread tool and mark this thread as Solved.

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

Similar Threads

  1. Auto fill field upon New Record selected
    By NOTLguy in forum Programming
    Replies: 27
    Last Post: 12-05-2010, 05:12 PM
  2. Form doesn´t update with Query.
    By disturbedgod in forum Forms
    Replies: 10
    Last Post: 02-09-2010, 02:00 PM
  3. Copying selected fields to a new record
    By Lyle Bitikofer in forum Forms
    Replies: 0
    Last Post: 12-13-2009, 04:01 PM
  4. Click a record to display it for edit
    By mapl in forum Access
    Replies: 0
    Last Post: 11-24-2008, 03:02 PM
  5. Loading the form with selected record
    By emilylu3 in forum Access
    Replies: 1
    Last Post: 12-09-2005, 07:49 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