GinaWhipp
AWF VIP
- Local time
- Today, 12:36
- Joined
- Jun 21, 2011
- Messages
- 5,899
Well, it's tomorrow and I have finally got a minute to type a reply, so here you go...
The bolded fields are the three Combo Boxes on your Form.
This code...
After you make your selection and click the button this...
...sets the WHERE statement for your Forms Record Source and the last two lines applies it to the Form.
In Design View add the Labels right above the Detail *bar*.
Yes, you will have to update anything that name is used in but not changing it will cause you issues down the road. We had a case of that last month and it took quite a while to figure out what the problem was.

Your database is small now, I know it might appear like a lot to you but call me when you have 100 Forms, countless queries, modules and tables
Implementing these changes now is not only a good idea but great practice and databases tend to take on a life of their own. They start growing and the next thing you know you end up with this...
http://www.access-diva.com/dm12.html
...and even that one is a baby. You want to make sure you are on the right path right from the beginning. AND, since you’re in the early stages of database development here are some links that might help...
Jeff Conrad's resources page...
http://www.accessmvp.com/JConrad/accessjunkie/resources.html
The Access Web resources page...
http://www.mvps.org/access/resources/index.html
A free tutorial written by Crystal (MS Access MVP)...
http://allenbrowne.com/casu-22.html
MVP Allen Browne's tutorials...
http://allenbrowne.com/links.html#Tutorials
UtterAccess Newcomer's Reading List
http://www.utteraccess.com/forum/Newcomer-s-Reading-List-t1998783.html
Help with Normalization
http://www.access-programmers.co.uk/forums/showpost.php?p=1146957&postcount=2
Sample data models...
http://www.databasedev.co.uk/table-of-contents.html
http://www.databaseanswers.org/data_models/
Other helpful tips…
Setting up a Model Database
http://www.access-diva.com/d11.html
My Database Standards...
http://regina-whipp.com/blog/?p=102
If you look at the Event Procedure behind the *Set Filter* button all the code is there. Basically, that code builds the WHERE statement for the Forms Record Source. So, here is your Record Source...1) You need to explain to me how you did this. Seriously. It's the whole eat fish for a day or learn to fish. If I don't understand how this is done, I'm going to be coming back on here in a couple of weeks or months and asking the same question for a different db.
Code:
SELECT Equipment_Spec.Picture, Equipment.Unit_Cost, Equipment.Quantity_Purchase, [Unit_Cost]*[Quantity_Purchase] AS Total, Equipment.Project_Name, Equipment.Supplier_Name, Equipment.[Location/Affiliate_Name]
FROM Equipment INNER JOIN Equipment_Spec ON Equipment.Equipment_ID = Equipment_Spec.ID;
The bolded fields are the three Combo Boxes on your Form.
This code...
Code:
If Not IsNull(Me.[COLOR=red]cboLocation[/COLOR]) Then
strWhere = strWhere & "([[B]Location/Affiliate_Name[/B]] = """ & Me.[COLOR=red]cboLocation[/COLOR]& """) AND "
End If
'Another text field example. Use Like to find anywhere in the field.
If Not IsNull(Me.[COLOR=red]cboProject[/COLOR]) Then
strWhere = strWhere & "([[B]Project_Name[/B]] Like ""*" & Me.[COLOR=red]cboProject[/COLOR]& "*"") AND "
End If
If Not IsNull(Me.[COLOR=red]cboSupplierID[/COLOR]) Then
strWhere = strWhere & "([[B]Supplier_Name[/B]] = " & Me.[COLOR=red]cboSupplierID[/COLOR]& ") AND "
End If
After you make your selection and click the button this...
Code:
strWhere = Left$(strWhere, lngLen)
[COLOR=#bfbfbf] 'Finally, apply the string as the form's Filter.[/COLOR]
Me.Filter = strWhere
Me.FilterOn = True
...sets the WHERE statement for your Forms Record Source and the last two lines applies it to the Form.
You can change the Record Source to anything you like BUT you must either keep the three field’s bolded above OR change the Combo Boxes accordingly. So, you can add and/or take away fields but you must remember the three fields above. Oh, and you can rename the query to anything you like, the fields are important the name is not.2) Is the form still using the DropDown qry test query (is that the event procedure On Click for the Set Filter button?)? If so, can I add the Madeup code column back in to the query results form?
You can set the Controls in the Detail Section to Locked = Yes and Enabled = No. Then they can look but no touch. I would also recommend making Allow Edits = No so there is no new record line at the bottom.3) Can I have the results be none editable? So basically just to see the results not be able to make changes to the records? (I tried changing the Allow Additions or Allow Deletions or Allow Edits to no in the property sheet but that just made the drop downs not work)
4) How can I add labels above the results columns to reflect what the column is? Yeah, I thought I could just move the query results down and add labels but that didn't work out so well
In Design View add the Labels right above the Detail *bar*.
As for your concerns of the db as a whole:
"1. Reserved Words
Table: Equipment spec
Field: Type
Using words reserved for Access as field names will cause problems for you because it confuses Access. You need to change the name of that field. (I have already checked all the other names)."
If I change the name now won't that mess up everything that's dependent on that table/field? The forms, the queries...
Yes, you will have to update anything that name is used in but not changing it will cause you issues down the road. We had a case of that last month and it took quite a while to figure out what the problem was.
If you get the chance you should try to fix what you can in this one. If I was coming in behind you I would have to stop and fix all of that before I could move forward, why? Because it just makes coding harder and the more you get into it the more you will realize how important it is to fix these things before they become issues. No pressure"2. Field Names
You have included spaces, underscores and slashes in your field names (and table names). This really makes coding a problem as the ones with spaces and slashes will require bracketing. I'm lazy and considering the amount of code I have to type I want to save all the key strokes I can. You need to adapt a Naming Convention, here's mine...
http://www.access-diva.com/d1.html
I understand. I'm still obviously new at designing db's and this is one of my first few db's I designed I will start to implement this with my next db.

Probably, but using names is like walking on egg shells because if you get a duplicate in one of those columns you are going to have to stop everything and fix it anyway."3. I do not recommend using any field that contains names as a Primary Key, i.e. your Location/Affililate table. Use a Autonumber as your Primary Key. Suppose you have to Locations with the same name? What are you going to do then? I strongly recommend you put a Primary Key that is an Autonumber in all your tables. After all, that number is for Access to maintain database integrity so no one needs to see it anyway."
Understood. Can I add an Autonumber to my tables now? Won't that affect all the forms and all the data that's already in the tables?
Your database is small now, I know it might appear like a lot to you but call me when you have 100 Forms, countless queries, modules and tables

http://www.access-diva.com/dm12.html
...and even that one is a baby. You want to make sure you are on the right path right from the beginning. AND, since you’re in the early stages of database development here are some links that might help...
Jeff Conrad's resources page...
http://www.accessmvp.com/JConrad/accessjunkie/resources.html
The Access Web resources page...
http://www.mvps.org/access/resources/index.html
A free tutorial written by Crystal (MS Access MVP)...
http://allenbrowne.com/casu-22.html
MVP Allen Browne's tutorials...
http://allenbrowne.com/links.html#Tutorials
UtterAccess Newcomer's Reading List
http://www.utteraccess.com/forum/Newcomer-s-Reading-List-t1998783.html
Help with Normalization
http://www.access-programmers.co.uk/forums/showpost.php?p=1146957&postcount=2
Sample data models...
http://www.databasedev.co.uk/table-of-contents.html
http://www.databaseanswers.org/data_models/
Other helpful tips…
Setting up a Model Database
http://www.access-diva.com/d11.html
My Database Standards...
http://regina-whipp.com/blog/?p=102