I have installed a simple progress meter on one of my forms which contains a lot of inline sql queries to bring up around 40 different statistics.
One group however brings up the number of injuries based on body location, department occurred in and the date to be viewed. I have noticed the progress bar takes longest during the execution of this part of the code.
The sql is as follows:
Expand|Select|Wrap|Line Numbers
- SELECT Count(*) AS CountOfInjuryID1
- FROM ((tbldept INNER JOIN (tblLocations INNER JOIN tblhselog ON tblLocations.LocationID = tblhselog.Incident_location) ON tbldept.DeptID = tblLocations.OwningDept) INNER JOIN tblInjuredPerson ON tblhselog.HSEID = tblInjuredPerson.HSEIDLINK) INNER JOIN (tblBodypart INNER JOIN tblInjuryInvestigation ON tblBodypart.PartID = tblInjuryInvestigation.InjuryLocation) ON tblInjuredPerson.InjuredPersonID = tblInjuryInvestigation.InjuredPersonLinkID
- WHERE (((tblhselog.Incident_date) Between fiscalStartDate('February',2011) And fiscalEndDate('February',2011)) AND ((tblBodypart.BodyPart)='Head/Face/Eye') AND ((tbldept.Department)='HS&E'));
I can not shorten the amount of steps needed to be taken to do this but I was wondering, at present I use text values to match records. Would my query be quicker if I used the integer values of the records instead?
E.g.:
Instead of searching for "Head/Face/Eye" which in table tblBodyParts is all within one row (it doesnt need to be normalised further as we use Head/Face/Eye as a single grouping) as my second column (text) where my first column is autonumber. Would it be better to search based on the Primary Key? (integer value).
I don't know whether access queries search better based on numbers rather than text