Results 1 to 9 of 9
  1. #1
    Accu-Grind is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2015
    Posts
    25

    Issues with combo boxes

    I have a combo box set up that when you pick the field, it pulls up information from other fields into text boxes. Here is my code:



    Sub Combo66_AfterUpdate()
    ' Find the record that matches the control.
    Me.RecordsetClone.FindFirst "[ID] = " & Me![Combo66]
    Me.Bookmark = Me.RecordsetClone.Bookmark
    End Sub

    I would like to have another combo box pull up information from another table, but I cannot get it to work right. I made an attempt and the only thing it did was reset the fields back to the first entry on all boxes. Is there a way to separate the tables so I can have two combo boxes?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    you assign a query to a combo box., not recordsets.

    cboNames.rowsource = "qsNameList"

    In the query qsNameList, it reads from the other combo,
    select name from table where [id] = " & forms!frmMyForm!combo66

  3. #3
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Where did you get that code from? I don't think I have seen an example like that before. I usually make a declaration of the Recordset object and then instantiate.
    https://msdn.microsoft.com/en-us/lib.../ff835062.aspx

    Also, when using the Me shortcut, I use the dot notation to access its members. The exclamation may work but I use that with fully qualified names.

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    No need for record sets. Use queries.

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Quote Originally Posted by ranman256 View Post
    No need for record sets. Use queries.
    It seems the OP is using the Bookmark property to navigate to a record. Although, I do not know how this relates to a combo "pull up information from another table" and what it is that is not working???

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725

  7. #7
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Your posted code is standard boilerplate for retrieving a Record from the Form's RecordSource. The Form has to have Controls that are Bound to the Fields of the RecordSource. Generally speaking, in order for the Form to allow updates, the RecordSource has to be based on a single Table or on a Query that is based on a single Table.

    But you appear to be talking about retrieving Records from a totally different RecordSource! To do that, you'd need a separate Form set up as described above for that Table. You can retrieve related data from a Table that is not the Form's RecordSource, using the DLookup function, but as orange suggested, you really need to tell us, in plain English, exactly what you're trying to do.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  8. #8
    Accu-Grind is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2015
    Posts
    25
    Sorry it took so long for me to get back

    What I am trying to do is this:

    I have a form that pulls up a suppliers name. I then need to pull up the customer's name. The problem is that the tables are linked together so when I pull up field (the supplier's name) it pulls up the corresponding field from the other table. I do not want this. I want them to be two separate identities.

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    Please show us the tables and relationships involved. jpg format is fine but you must ensure tables are expanded so we see all fields.
    Linq has given a good overview of the code you have and how it is used(generally).

    You're talking form, controls, then tables --we need to see the data and structure involved.
    We are not "getting" the requirement and have no idea of the data and structures.

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

Similar Threads

  1. Replies: 11
    Last Post: 08-06-2014, 09:47 AM
  2. Replies: 9
    Last Post: 06-04-2014, 10:45 AM
  3. Replies: 6
    Last Post: 02-19-2014, 11:11 AM
  4. Combo Box Issues on Form
    By aceoftrades in forum Forms
    Replies: 4
    Last Post: 12-28-2013, 12:47 PM
  5. Replies: 3
    Last Post: 06-09-2013, 05:35 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