Open subform to specific records based of off input from combo boxes (1 Viewer)

vbaInet

AWF VIP
Local time
Today, 12:40
Joined
Jan 22, 2010
Messages
26,374
Program Customer ModelYear is the form that I would like to filter the records on. That in turn opens up Program Customer Model Year form (which has a subform).
You know you're just going to confuse yourself with those names. And besides that it's not good practice to include spaces in your names.
 

mayestom

Registered User.
Local time
Today, 07:40
Joined
Jul 7, 2014
Messages
213
I know. I'm sorry. It's not my idea. I'm working on this db with someone else. As you can see some of the naming convention is ok, some not so much.
 

vbaInet

AWF VIP
Local time
Today, 12:40
Joined
Jan 22, 2010
Messages
26,374
You don't need to be sorry, I was only highlighting it :) I'll have a look later.
 

vbaInet

AWF VIP
Local time
Today, 12:40
Joined
Jan 22, 2010
Messages
26,374
Ok, which fields do you want to filter on? Program, Customer and ModelYear?

If this is the case then I can see that these fields are the link fields between the parent form and the subform so all we need to do is filter the parent form and the subform will follow suit.
 

mayestom

Registered User.
Local time
Today, 07:40
Joined
Jul 7, 2014
Messages
213
Yes correct, to filter on Program, Customer and ModelYear. Just to make sure, this is in the form named "Program Customer ModelYear". And that is considered the parent form and "Program Customer Model Year form" is considered the child (with a subform)?
 

vbaInet

AWF VIP
Local time
Today, 12:40
Joined
Jan 22, 2010
Messages
26,374
Yes I'm talking about the form with the subform (whatever the name is) ;)
 

mayestom

Registered User.
Local time
Today, 07:40
Joined
Jul 7, 2014
Messages
213
Okay understood. But we’re going to add the filters to the parent form, “Program Customer ModelYear”. I’m sorry if I’m repeating myself, I just want to make sure I’m on the same page.
 

mayestom

Registered User.
Local time
Today, 07:40
Joined
Jul 7, 2014
Messages
213
Ok I have attempted creating a filter on the form. It is not filtering on the selected field that you choose. Whenever you choose a value and click filter all the records go away. The form name is 'Program Customer ModelYear'. Would someone please take a look at it and tell me what I'm doing wrong?
 

Attachments

  • Packaging db - Mockup.zip
    1 MB · Views: 94

vbaInet

AWF VIP
Local time
Today, 12:40
Joined
Jan 22, 2010
Messages
26,374
Ok I have attempted creating a filter on the form. It is not filtering on the selected field that you choose. Whenever you choose a value and click filter all the records go away. The form name is 'Program Customer ModelYear'. Would someone please take a look at it and tell me what I'm doing wrong?
What you're trying to build is not a search form and the code you've used in your db is from Allen Browne's website but you've not left the credits.

See attached a working db.

I've not had a thorough look at your db but from the tables/queries that are related to the forms I was looking at, you have some fundamental issues:
1. Use of lookup fields in field level. Some of your queries and tables are a mish mash of the ID number or the related text. Lookups in fields (i.e. having a combo box in the field) should not be used and here's why:
http://access.mvps.org/access/lookupfields.htm
2. One or more of your tables is/are not related to anything when it actually should. Look into setting up relationships and referential integrity in the Relationships Designer.
3. Based on the points above I think your tables could be better normalised.

You'll benefit from creating a new thread asking for assistance on your table structure and setup.
 

Attachments

  • Packaging db - Mockup.zip
    1.1 MB · Views: 78

mayestom

Registered User.
Local time
Today, 07:40
Joined
Jul 7, 2014
Messages
213
vbaInet
I’m sorry I don’t know how it happened that Allen Browne’s credit was left out of the code. Please know that I would never do something like that intentionally. I was working on the code, copying and pasting and changing this and that trying to get the code to work and somehow it got left out. As an example of how much I appreciate others helping me out, please look at this post from another form. Someone was helping me with another piece of code and I wanted to give them credit in the code. I honestly would never pass off someone else’s work as my own. I shall be more careful in the future.

As for the db:
1. Use of lookup fields in field level. Some of your queries and tables are a mish mash of the ID number or the related text. Lookups in fields (i.e. having a combo box in the field) should not be used and here's why:
I understand you shouldn’t use Lookup’s in the tables but where can you use Lookup fields? On the forms? If you shouldn’t use Lookups in the tables why is the option there?
2. One or more of your tables is/are not related to anything when it actually should. Look into setting up relationships and referential integrity in the Relationships Designer.
The db that I uploaded is only a mockup of the original. So some of the tables/forms/macros aren’t working/don’t make sense/or still being worked on. But I do realize that I still have much to learn and I appreciate all the guidance/constructive criticism/tips/pointers that I can get from you and other helpful users on this form and others have given me.

I looked at the attached db that you posted. I’m not sure what you want me to look at? It looks like the same db I posted earlier.
 

vbaInet

AWF VIP
Local time
Today, 12:40
Joined
Jan 22, 2010
Messages
26,374
You didn't need the long explanation, I was only reminding you ;)

Run the forms.
 

vbaInet

AWF VIP
Local time
Today, 12:40
Joined
Jan 22, 2010
Messages
26,374
I understand you shouldn’t use Lookup’s in the tables but where can you use Lookup fields? On the forms? If you shouldn’t use Lookups in the tables why is the option there?
As for Lookups, they just should never be used simply because they mask the true nature of the data that should be saved in that field.

In place of lookups, you create relationships in the Relationships Designer and when building the queries join the parent and child tables via the ID to pull in the respective text.
 

mayestom

Registered User.
Local time
Today, 07:40
Joined
Jul 7, 2014
Messages
213
I'm really sorry vbaInet, I'm sure I'm missing something, but I can't see any difference in the forms.
I've attached an updated version of the db. The form name is Program Customer ModelYear. Customer and engineer filters seem to be working but not all Programs are being filtered on. For example if you select JK, A1XC or KL it doesn't filter on them. If you wouldn't mind taking a look at it to see what you think, I'd appreciate it.
 

Attachments

  • Packaging db - Mockup.zip
    237.1 KB · Views: 75

vbaInet

AWF VIP
Local time
Today, 12:40
Joined
Jan 22, 2010
Messages
26,374
You're looking at the wrong version. Clear your downloads folder and re-download the one in my post.
 

mayestom

Registered User.
Local time
Today, 07:40
Joined
Jul 7, 2014
Messages
213
I redownloaded the db you posted and I've attached a screen shot of the form, it's still the same. I'm not sure what I'm missing? :confused:
 

Attachments

  • Screenshot-Mockup.PNG
    Screenshot-Mockup.PNG
    28.1 KB · Views: 111

mayestom

Registered User.
Local time
Today, 07:40
Joined
Jul 7, 2014
Messages
213
OH!!! I see know. When you click the Open button the form it opens is filtered to that lines criteria. I understand know. But that was how it was set up to begin with. What I was trying to do was to filter the records on that first form. bc there are eventually going to be hundreds of records that you can open and I would like to give the user the ability to filter them to get to the ones he/she is working on. If you look at the latest db I posted you'll see that I added combo boxes at the top of the form so you can filter the records on the first form. But that's where I'm having problems. I can't get the Program filter to work properly. The Customer and PKG Engineer seem to be working.
 

vbaInet

AWF VIP
Local time
Today, 12:40
Joined
Jan 22, 2010
Messages
26,374
Alright, the way you explained your OP gave the impression that you want to open another form that had a subform and base it on the records of the subform in the opening form.

Did Allen Browne's code not work? Now because you have these lookup fields strewn all over the place, and you're not consistent in which Program field to use (i.e. ID or Texrt part) your filter may not work. You need to sort out the lookups part and keep things consistent.
 

Users who are viewing this thread

Top Bottom