Results 1 to 4 of 4
  1. #1
    vincenoir is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2009
    Posts
    2

    Auto-Populate Combo box

    Hi Everyone

    My first post, I'm quite new to access, particularly using VBA and SQL in access, I've searched all over the net for a solution to this problem and hope someone can help. It's probably really simple, but like I said, I'm new

    I have a form with a combo box that populates it's values using a SQL query. This query takes it's one of it's properties from the form (cboCombo1):

    SELECT tblTable1.PageName


    FROM tblTable1
    WHERE tblTable1.field1=Forms!frmForm1![cboCombo1]
    AND tblTable1.Field2=0;

    My problem is that I need the combo box to populate the values each time you try use it, as cboCombo1 changes depending on what record you are viewing/editing.

    Hope this is clear!

    Thanks in advance.
    Last edited by vincenoir; 10-14-2009 at 01:41 AM.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Requery the ComboBox in the GotFocus or OnEnter event of the ComboBox.
    Me.ComboBoxName.Requery
    ...using your ComboBoxName of course.

  3. #3
    vincenoir is offline Novice
    Windows XP Access 2003
    Join Date
    Oct 2009
    Posts
    2
    Thanks very much. Worked perfectly.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Glad I could help.

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

Similar Threads

  1. Replies: 3
    Last Post: 10-05-2009, 07:22 AM
  2. Auto Populate Data from Main Form
    By billiejean in forum Forms
    Replies: 0
    Last Post: 08-05-2009, 08:08 AM
  3. Populate Combo Box
    By wes28 in forum Programming
    Replies: 1
    Last Post: 03-04-2009, 06:45 AM
  4. auto populate and table relationships
    By jmarti57 in forum Access
    Replies: 0
    Last Post: 11-09-2008, 09:50 PM
  5. Auto populate fields on a form
    By ldarley in forum Forms
    Replies: 0
    Last Post: 08-14-2008, 09:39 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