Filter records based on a combo box

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

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.
 

Attachments

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.
 

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!
 

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.
 

Attachments

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!
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

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 807,865 other people just like you!

Latest posts

Members online

Top