1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Filter records based on a combo box

Discussion in 'Business Applications' started by NEWBIE57, Nov 24, 2011.

Thread Status:
Not open for further replies.
Advertisement
  1. NEWBIE57

    NEWBIE57 Thread Starter

    Joined:
    Jan 18, 2011
    Messages:
    65
    Hi, I need some help, think it's mainly VB syntax, but could be more. In a Form called frmDescription, I want to select a description from the combo box and then display the realted fields from the subform Costing Sheet CS Form. This description is pulled from the table Costing Detail tbl. And I want the fields, route, blank length and waste factor to all populate from the description choosen from the combo box. I've already made a sample of the database, because I do feel it's syntax and it's easier to help.

    Thank you in advance for your help.
     

    Attached Files:

  2. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    I really think that you have too many tables in your database.
    Also there are no relationships between them.
     
  3. NEWBIE57

    NEWBIE57 Thread Starter

    Joined:
    Jan 18, 2011
    Messages:
    65
    I agree on the relationship issue, though I'm not the one that actually maintains this database. All I really want to do is get this form working, so the end users can just type in description with the other data automatically populating. Is there a way I can do this or should a major overhaul be completed. As for too many tables, I don't know for sure if all of them are being used, looking them over it seems some are redundant???

    Thanks!
     
  4. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    I have removed your action macros while I developed your answer.
    I have provided 2 versions of how to do it.
    I modified your original form so that it had the same recordset as the Combo and then the subform is linked via the Description fields. I then modified the Combo to a "Find combo which finds a record on the mainform, which then finds the record on the subform.
    The second version "Description2" uses VBA to set the Subform's Filter to the mainform's Combo.
    To be quite honest there seems to be a great deal of duplication in the database and it is not ideal to be linking forms or tables using text fields like the Description field, the slightest mispelling of one of them would lead to the records not being found.
     

    Attached Files:

  5. NEWBIE57

    NEWBIE57 Thread Starter

    Joined:
    Jan 18, 2011
    Messages:
    65
    Thank you for your response and examples, I will try them. I really have nothing to do with this database unless the main person is gone and then I get dragged into it. I so understand that relationships need to be set up and I was thinking of adding a sequential "auto" number. I think I know how to do that and then just linked that to the other tables. right? But then I would have to manually entered the number in the other tables?

    Also the description field in this form is from a drop-down box, so the chance for error is minimal, but do understand if the users were just keying it in each time.

    Again thanks for your help!
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1028306

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice