Results 1 to 7 of 7
  1. #1
    Huddle is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jun 2010
    Posts
    318

    Enter Data in Field or Have it Auto Populate from a Combo

    I have a form that I am using for a parameter entry. The user is to enter the building number in a combo box field which is connected as the parameter in the query. I want to add a feature, maybe a combo box, that if they don't know the building number they can look it up by the address. When they select an address I want the building number associated with it to populate the first field. What would you suggest as being the most efficient way to do this?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    The address search combobox would be unbound. Then in the AfterUpdate event set the value of the other combobox (I use only VBA):

    Me.cbxBuilding = Me.cbxAddress
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Huddle is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jun 2010
    Posts
    318
    The BldgCmb would not match the AddCmb. It will pull the building number from the query. Here is the code I have but it is not filling in the BldgCmb.

    Private Sub Cmb_Commander_AfterUpdate()
    Me.Visible = False
    End Sub

    Private Sub AddCmb_AfterUpdate()
    Me.BldgCmb = Me.AddCmb.Column(3)
    RunCommand acCmdSaveRecord
    End Sub

    Private Sub CityCmb_AfterUpdate()
    Me.AddCmb = ""
    Me.AddCmb.Requery
    RunCommand acCmdSaveRecord
    End Sub

    Private Sub StateCmb_AfterUpdate()
    Me.CityCmb = ""
    Me.AddCmb = ""
    Me.CityCmb.Requery
    RunCommand acCmdSaveRecord
    End Sub

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    If you want to provide db, will analyse. Follow instructions at bottom of my post.

    Do you want empty strings in fields? If not, set the bound controls to Null, not "". I don't allow empty strings in any fields.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Huddle is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jun 2010
    Posts
    318
    unfortunately due to highten security at our company I am unable to send the database. I've put an example below if that helps

    The building number is CO006.
    The address 123 Main.
    When the AddCmb field is updated with 123 Main, CO006 should populate the BldgCmb. But I want them to have the option also if they already know the building number to just be able to put it in without going through the addresses.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    That doesn't help me analyse your issue. I set values of fields with code all the time so can't replicate problem. If you can't scrub the db to remove confidential data and provide it (or an extract of the relevent objects), can't help.

    I will add that I don't see need for the acCmdSaveRecord action.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Huddle is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jun 2010
    Posts
    318
    I figured it out. My column count in the format was off.

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

Similar Threads

  1. Replies: 5
    Last Post: 03-07-2012, 12:57 PM
  2. Replies: 2
    Last Post: 12-07-2010, 12:32 PM
  3. Auto populate form using combo box
    By bundy75 in forum Access
    Replies: 6
    Last Post: 08-29-2010, 06:18 AM
  4. auto populate combo field?
    By myboii in forum Access
    Replies: 8
    Last Post: 07-09-2010, 05:46 AM
  5. Auto-Populate Combo box
    By vincenoir in forum Forms
    Replies: 3
    Last Post: 10-14-2009, 07:06 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