Results 1 to 11 of 11
  1. #1
    jheacox is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2009
    Posts
    6

    combo box disable edit (update)

    I am new to Access 2007, and I am having dificulty with the combobox properties in my form.



    Let me explain: I have created a form with a subform. The main form consists of one field displayed in a combo box, when an item is selected from the pulldown the subform displays it's info.

    The problem is when I select an item from the combo box pulldown it is assumed that I want to update the db field. The little pencil comes up, and I get a pop-up with an error because the db field is defined as a unique. Cannot insert duplicate key yada, yada, yada.

    How do I disable the edit feature on the combo box?? I have tried setting all of the different properties, but none of them seem to disable the edit function. I really don't want to write any VB code or macros - Is there an easy solution to my problem?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Simply remove the ControlSource of the ComboBox.

  3. #3
    jheacox is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2009
    Posts
    6

    Need to have Control Source to populate subform

    If I remove the Control Source then the subform does not get populated. Essentially it can't query the db if it doesn't have a ControlSource.

    I also have a query in the RowSource "select column1 from table1".

    Do I need to have the Row Source defined?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    How about posting your db so we can look at it?

  5. #5
    jheacox is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2009
    Posts
    6

    can't post db

    Sorry can't post db, but basically there are 2 tables used for my form.
    =========================================
    Table1

    Hosts - which is just a list of hostnames

    Table 2:

    FileList by hostname (fk to the Hosts.hostname table): 1 - many relationship
    ============================================
    Form combobox queries hosts to populate the subform that has the FileListing.

    The navigation buttons at the bottom work fine, and the combo box value changes with the buttons. It only tries to update the Hosts table when you use the combo box pulldown to select a host.

    I created the form using the Forms Wizard. Then changed the Hostname text box to a comboBox so the user can pulldown the hostname from a list.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    TRy putting a new ComboBox on the MainForm with the wizard and select Option #3. If the LinkChild/MasterFields properties are completed properly, it should do as you want.

  7. #7
    jheacox is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2009
    Posts
    6

    The combo box now works but the navigation buttons don't

    The combo box works fine now with option 3, but now when I use the navigation buttons at the bottom the subform changes but the comboBox doesn't. How do I link the navigation buttons with the new combo box?

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The new cbo is just for moving to a record and is unbound. You could use the Current event of your form to set the value displayed by the cbo if you want.

  9. #9
    jheacox is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2009
    Posts
    6

    How do I do that?

    Sound like a plan. How do I do that? Remember I'm a novice.

    thanks for your help so far.

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Your code will look something like:
    Code:
    Private Sub Form_Current()
     
       Me.YourComboBoxName = [TheFieldYouWantDisplayedInTheComboBox]
       
    End Sub
    Using your values for the items in RED.

  11. #11
    jheacox is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2009
    Posts
    6
    Thanks, that worked. How do I set this as solved?

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

Similar Threads

  1. Replies: 3
    Last Post: 08-06-2009, 11:49 PM
  2. Use combo box to update other fields
    By Shep in forum Access
    Replies: 7
    Last Post: 07-23-2009, 03:11 PM
  3. How to disable edit for combo boxes
    By access in forum Forms
    Replies: 3
    Last Post: 06-17-2009, 09:11 AM
  4. Combo-box to select item to edit in Form
    By DHavokD in forum Forms
    Replies: 7
    Last Post: 06-05-2009, 01:39 PM
  5. After Update for a second Combo box
    By nywi6100 in forum Forms
    Replies: 0
    Last Post: 10-23-2006, 03:07 PM

Tags for this Thread

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