REPORT ON INDUSTRIAL ATTACHMENT WITH ST AEROSPACE SYSTEMS PREPARED BY: ZHANG ZHIRONG 054535B06 CE Table of Contents Page Abstract i Acknowledgement ii List of Figures iii Chapter One: Introduction 1 1.1 Background 1.2 Purpose 1.3 Scope Chapter Two: Approved Certified Holder Test System 2.1 Background, Purpose and Scope 2.2 Admin Menu Items 2.2.1 Login Page 2.2.2 Admin.’s Menu 2.3 Admin operations 2.3.1 Assign Examinee Paper 2.3.2 Generate Report 2.3.3 Set Questions 2.3.4 Set Paper Type 2.3.5 View Examinee answer archive 2.4 Examinee operations 2.4.1 Confirm Particulars 2.4.2 Take Test 2.4.3 View Results 2.5 Security 2 2.5.1 Direct Question Bank Access 2.5.2 Linked tables 2.5.3 User application Chapter Three: Incident Reporting System 19 3.1 Background, Purpose and Scope 3.2 Menus 3.3 Handling Forms 3.3.1 Enable Data Entry 3.3.2 Refreshing Forms Chapter Four: Library Loans System 24 4.1 Background, Purpose and Scope 4.2 New Loan Record 4.2.1 Using Sub Forms 4.2.2 Borrower Friendly Design 4.2.3 Clean Records 4.3 Return of Manual 4.3.1 Design Methods Chapter Five: Roster Database System 5.1 Background, Purpose and Scope 5.2 Report Viewing Methods 5.2.1 Order by 5.2.2 Group by 5.2.3 Search by 29 5.3 Keeping track of Last Update Chapter Six: Approved Certified Holder Database System 35 6.1 Background, Purpose and Scope 6.2 Manipulating Records 6.3.1 Deleting Single Record 6.3.2 Detecting overdue and prompting Chapter Seven: Swift Database System 39 7.1 Background, Purpose and Scope 7.2 Functions 7.2.1 VLookUp 7.2.2 Recording Macros 7.2.3 Removing Spaces and Dashes in the Data 7.2.4 Pivot Tables 7.2.5 Siphoning Data from Commas Chapter 8: Inventory Bouncing System 47 8.1 Background, Purpose and Scope 8.2 How it works 8.2.1 Theory and Example 8.2.2 Finding Unmatched Inventory Chapter 9: Summary and Conclusion 9.1 Summary 9.2 Conclusion 51 References Appendix A: AC Holder Test Screen Shots Appendix B: Incident Reporting System Screen Shots Appendix C: Library Loans System Screen Shots Appendix D: Roster Database System Screen Shots Appendix E: Swift Database System Screen Shots Appendix F: Access Bouncing Screen Shots 53 Abstract ST Aerospace Systems is an Aircraft Component Repair Company. Aircraft land on the runway at an airport nearby and would be towed to the repair hanger in Aerospace when aircraft repairs are needed. During my Industrial Attachment in ST Aerospace Systems, I was tasked with programming applications and maintaining database systems using Microsoft Access 2000 as my major workload. In this report, the focus would be on the projects I have done using the Microsoft Access 2000 and Excel. The projects mainly deal with Macros, Queries, Forms and Tables. For the content, it would be about the explanation of how the work was done and the problems encountered. Projects involved applications and database systems that were essential to the Quality Assurance department, Library and company. They would help to improve work process in terms of quality and job completion rate. It has been a gratifying Industrial Attachment experience and I have learned a lot during my 5.5 months of stay. The company has been constantly improving their work practices and encourages promoting innovative ideas to drive the company towards world class. i Acknowledgement ST Aerospace Systems Eugene Tan Quality Assurance Manager Heng Xiang Xin Quality Assurance Engineer/Mentor Hui Win Sun Quality Assurance Shop Inspector Edmund Yap Library Manager Ghana Library Assistant Victor Foo Human Resource Manager Nanyang Technological University Bertil Schmitt Industrial Attachment Supervisor ii List of Figures Fig 2.2.1.1 Admin Login Fig 2.2.2.1 Admin Main Menu Fig 2.3.1.1 Open Employee Data to set paper type Fig 2.3.2.1 List of Examinee results Fig 2.3.3.1 Add and edit Questions Fig 2.3.3.2 Option groups Fig 2.3.3.3 Inserting pictures into Database Fig 2.3.4.1 Creating Paper Type Fig 2.3.5.1 Answer Archive Fig 2.4.1.1 Employee Particulars Fig 2.4.1.2 Macro to Start Test Fig 2.4.2.1 Test Paper Fig 2.4.2.2 Macros used in Test Paper Fig 2.4.2.3 Queries used in Test Paper Fig 2.4.3.1 Confirm End Test Form Fig 2.5.1.1 Setting Password Protection Fig 2.5.2.1 Links to the tables from Question Bank. Fig 2.5.3.1 Altering Startup Procedures Fig 3.2.1 Menu items Fig 3.3.1.1 Enabling Data Entry iii Fig 3.3.1.2 Copy Values to Hidden Fields Fig 3.3.2.1 Updating Time Close Fig 3.3.2.2 Refreshing Form Fig 4.2.1.1 Creating a sub form Fig 4.2.2.1 Create a user friendly design Fig 4.2.3.1 Deleting null values Fig 4.3.1.1 Design of return technical manual page Fig 5.2.1.1 Preparing a ‘Order by’ Report Fig 5.2.2.1 Preparing a ‘Group by’ Report Fig 5.2.2.2 Macros to prepare for the ‘Group by’ Report Fig 5.2.3.1 Preparing a ‘Search by’ Report Fig 5.3.1 Updating Last Update Fig 6.3.1.1 Snap shot of a form with many entries Fig 6.3.1.2 Setting button properties in design view Fig 6.3.1.3 Creating the delete macro Fig 6.3.2.1 Query Design using totals Fig 6.3.2.2 Creating forms with Query as Data source Fig 6.3.2.3 Creating macro to detect expiry and prompt Fig 7.2.1.1 Example of VLookUp Fig 7.2.1.2 Example of Setting up VLookUp Fig 7.2.2.1 Record a Macro iv Fig 7.2.4.1 Example of a Pivot Table Fig 7.2.4.2 Procedure to create Pivot Table Fig 7.2.5.1 Text to Columns Function Fig 8.2.1.1 Venn Diagram of Inventory Bouncing Fig 8.2.2.1 Importing External Data Fig 8.2.2.2 Creating Find Unmatched Query Fig 8.2.2.3 Example Table Results of Inventory Bouncing v Chapter One: Introduction 1.1 Background Microsoft Access 2000 is a very efficient application and database system creator program. It also makes programming easier as most of the projects are created by a series of mouse clicks instead of the usual way of typing long, countless lines of codes. The types of application and database systems that can be created by Microsoft Access 2000 are limitless. Some examples include a Library Loans System, Incident Reporting System, an Online Test, Report Generation System and Employee Database System. 1.2 Purpose Companies need to upgrade their software system on their own sometimes as relying everything to a third party company would add to expenditure. Furthermore, third party companies have to understand the internal work processes before they can create a flawless program. As such, it would be wise for employees to pick up the skill of programming. Microsoft Access 2000 allows employees to fulfill this goal as this program makes programming simple. This in turn would greatly assist them in their tedious work processes and save lots of man hours. 1.3 Scope This report will cover some of the projects I have done. The focus would be explaining how the Macros, Queries, Forms and Tables are done, the problems encountered and the motivation for certain engineering design structure. 1 Chapter 2: Approved Certified Holder Test 2.1 Background, Purpose and Scope Technicians need to be qualified to work on certain stuff. In order to do that, they would need to take certain tests. AC Holder Test is an application created with Microsoft Access 2000 that helps different groups of technicians to be qualified to do their respective jobs. In the past, the examiner would have to prepare questions, set up the examination venue, mark the papers and generate reports manually. This was a tedious process and lots of man hours were wasted. With the AC Holder Test application, lots of man hours would be saved. The AC Holder Test application consists of three separate parts – examinee, examiner and question bank. The examinee would only be allowed to take the test. The examiner can add questions and set paper. The question bank contains all tables. Examiner would just need to input all questions into the Question Bank as well as set the Paper Type for all employees. The AC Holder Test application would handle the paper preparation, mark the papers and generate reports automatically. Examinees can sit for the test on any computer connected to the network. The question bank would be removed from the public folder to a private folder after the exam is over for security reasons. This chapter will explain the creation of this whole application, its techniques and its reason for such a design. The focus would be on the tables, queries, macros and reports. 2 2.2 Admin Menu Items 2.2.1 Login Page Fig 2.2.1.1 Admin Login From the ‘Admin Sign in’ form, the ‘Open Admin Main Menu’ macro was assigned to the ‘Log in’ button of which the condition stated that the related fields in ‘Admin Main Menu’ form should have the matching values ‘AdminID’ and ‘AdminPass’ as its record source from the ‘Admin Login’ table. In the ‘Admin Main Menu’ form’s ‘On Open’ properties, the ‘Admin Number not found’ macro was set to check a match with the fields in the ‘Admin Sign in’ form. If no match were found, the ‘Admin Main Menu’ form would be closed. 3 2.2.2 Admin.’s Menu Fig 2.2.2.1 Admin Main Menu ‘Open Employee Data’ allowed the examiner to set the type of paper the examinee can take. ‘Open Employee Results Report’ enabled the examiner to view the list of examinees who passed or failed the test. ‘Open Question Bank’ lets the examiner add or edit the exam questions. ‘Set Paper Type and Marks’ was for the examiner to create a new type of paper and to set the marks for right and wrong answers as well as the marks required to pass the exam. ‘Open Employee Answer Archive’ made sure the examiner were able to verify that the examinees get the marks they deserved as their answers were recorded next to their examination questions. 4 2.3 Admin operations 2.3.1 Assign Examinee Paper Fig 2.3.1.1 Open Employee Data to set paper type The examiner could easily filter the records according to their fields and quickly assign the paper types for that group of examinees by pressing the shortcut keys as displayed in Fig 2.3.1.1. Clicking on the ‘Show all Records’ button would display all records again. The examiner could also use the search fields, which would highlight the search result in the respective fields to find the targeted record quickly. 5 2.3.2 Generate Report Fig 2.3.2.1 List of Examinee results There were two ways to create a report. One way was creating the report via report wizard; the other was setting the data source of the report to the designated query or table and placing the fields manually. 6 2.3.3 Set Questions Fig 2.3.3.1 Add and edit Questions The examiner could add or edit questions with its correct answers. The bottom right of the form had an option group which inserted an assigned value when the corresponding radio button was selected into the table with the corresponding field. 7 Fig 2.3.3.2 Option groups The ‘create option group’ button was clicked and dragged out to the desired size onto the form. An option group wizard automatically appeared and the parameters were keyed in to suit the situation. Fig 2.3.3.3 Inserting pictures into Database Microsoft Excel would not accept pictures, as the fields did not have the appropriate ability to store pictures. Microsoft Access 2000 had the ability to accept pictures due to the availability of the OLE object format. 8 The diagram box was right clicked on and ‘insert object’ was selected. Since this box was linked to a field in the table whose format was OLE object, it could also accept video clips. For inserting images, ‘Bitmap Image’ was chosen. With the diagram box still in edit mode, ‘paste from’ option was selected from the ‘edit’ menu and an image in ‘jpg’ format was selected from a folder. 2.3.4 Set Paper Type Fig 2.3.4.1 Creating Paper Type This form allowed the examiner to create a new paper type as well as set the corresponding fields as shown in Fig 2.3.4.1. 2.3.5 View Examinee answer archive Fig 2.3.5.1 Answer Archive This table allowed the examiner to verify examinees grades according to the answers they gave to the questions they had. 9 2.4 Examinee operations 2.4.1 Confirm Particulars Fig 2.4.1.1 Employee Particulars When the examinee logs in, the ‘employee pretest particulars’ form would display all the particulars of that particular examinee only. This was due to the conditions set in the ‘Open Employee pretest Particulars’ macro. [Emp_no] referred to the text field in the ‘employee pretest particulars’ form and [Text21] referred to the text field in the ‘Employee Sign in’ form. If a matching employee number was not found, the ‘employee pretest particulars’ form would be closed by the ‘Employee number not found’ macro. 10 Fig 2.4.1.2 Macro to Start Test When the ‘Start Test’ button was clicked on, the ‘StartTest’ macro would be executed. The paper would then be set up accordingly with a count down timer. Basically, the questions would be copied from the ‘Questions’ table to the ‘Employees answer’ table, then the extra questions would be deleted. After that, the questions would be randomized for the next examinee. 11 2.4.2 Take Test Fig 2.4.2.1 Test Paper In Design View, ‘=Format([Date],"Medium Date")’ was typed in the ‘Date’ field, ‘=[Forms]![Employee pretest particulars]![Text52]’ was typed into the ‘Start Time’ field, ‘=Format(Time(),"Medium Time")’ was typed in the ‘CurrentTime’ field, ‘=DateDiff("n",[Text109],[Text111])’ was typed in the ‘Time Remaining’ field and ‘=DateAdd("h",1,[Text115])’ was typed in the ‘End Time’ field to give the desired results as seen in Fig 2.4.2.1. Screen refresh was done every minute since there were no text fields in the form where user would type for more than a minute. The ‘End Test’ button would take the examinee to the ‘Confirm End Test’ form. This enabled examinees to be sure that they were ready to end the test. The option group on the left input data into the ‘ownanswer’ field of the ‘Employees Answer’ table. 12 Fig 2.4.2.2 Macros used in Test Paper ‘GoTo Next Record’ macro was assigned to the ‘Next’ button. This would allow the message to appear when the last question was reached. The ‘GoTo Previous Record’ macro was assigned to the ‘Previous’ button to prevent an error message from occurring when the question number ‘0’ was not found. [Text117] referred to the ‘Time Remaining’. The ‘CalculateAward’ macro was set in the ‘On Exit’ property of the option group which belonged to a sub form with record source linked to a table and not a query. Since the main form’s record source was linked to a query, option groups would not work on the main form. 13 Fig 2.4.2.3 Queries used in Test Paper Fig 2.4.2.3 showed an update query used in the ‘Test Paper’ form. Marks were awarded according to the examinees response to the question. 14 2.4.3 View Results Fig 2.4.3.1 Confirm End Test Form The ‘Confirm End’ button was clicked and a ‘Are you sure?’ message box was displayed. When the ‘Cancel’ button was pressed, the macro would stop. However, if the ‘OK’ button was clicked on, the macro would continue to execute to the next line. The ‘Insert Score Query’ would sum up the marks and the next two queries would update a pass or fail status accordingly. Lastly, the result page would be displayed to the examinee. 15 2.5 Security 2.5.1 Direct Question Bank Access Fig 2.5.1.1 Setting Password Protection The Question Bank should be password protected so that no examinees could steal the questions freely. The file had to be opened exclusively first before setting the password protection. 16 2.5.2 Linked tables Fig 2.5.2.1 Links to the tables from Question Bank The links were created so that when the question bank was taken out from the folder, the AC Holder Test application would not allow anyone to take a test at any point in time. This would prevent any attempt to hack into the question bank when no administrator was attending to the application. 17 2.5.3 User application Fig 2.5.3.1 Altering Startup Procedures If no user should be allowed to touch any other options or menus while using the application, the startup option settings should be changed. All check boxes were unchecked to prevent any alteration to the application by any user. One word of caution though; there would be no turning back once the options were set and they cannot be undone as the ‘tools’ menu would disappear. It would be necessary to create a backup of the application before proceeding with the change. 18 Chapter 3: Incident Reporting System 3.1 Background, Purpose and Scope Employees sometimes discover some problems in the workplace and they need to inform the proper authorities to solve the problem. Record keeping would be important for archiving to assist in analytical purposes. The Incident Reporting System would allow employees to key in any incident that requires attention and a team would be created to solve the problem. At the end of the month when the problem is solved, the associated employees would close the incident case. Incentives would be given to the associated employees and his team for a good job done. The administrator would be able to generate open cased and close cased incident reports via a click of a button. Open cased reports would show which incident is still being solved. Close cased reports would show the solutions implemented to solve the problems. With this system in place, companies could strive to reduce customer complains, accidents and auditor findings. It would also raise environmental awareness, safer working conditions as well as preservation of the company’s image. This chapter discusses the special implementations of the applications and how to handle them. Its special focus is on the double field technique and the on form updating/refreshing techniques. 19 3.2 Menus Fig 3.2.1 Menu items Administrator would be required to login as employees should not have access to the reports. 20 3.3 Handling Forms 3.3.1 Enable Data Entry Fig 3.3.1.1 Enabling Data Entry Since Microsoft Access 2000 forms immediately register the data into the tables when the data was keyed into the text field. There were two ways to enable data entry only when it was required. Fig 3.3.1.2 Copy Values to Hidden Fields 21 One was to set the property value of the form to enable addition of data when a button was clicked on. The other was to copy the values from unbound fields to the fields that linked to the tables that were hidden when a button was clicked on. 3.3.2 Refreshing Forms Fig 3.3.2.1 Updating Time Close 22 Updating a form on the spot requires some refreshing mechanism. The question was when to refresh the form. If refreshing of form were done every minute interval, the user would not have enough time to type a paragraph for more than a minute as the paragraph would disappear from the text field. Fig 3.3.2.2 Refreshing Form Fig 3.3.2.2 showed how the refreshing macro was done. It was set in the ‘after update’ property of the ‘implementations’ text field. After the user clicked on the ‘close incident’ button. The refreshing macro would also be executed. 23 Chapter 4: Library Loans System 4.1 Background, Purpose and Scope Technicians would need to borrow the required technical manuals before they are able to proceed with their aircraft part repair job. During the borrowing phase, the Library Loans System would be able to display a list of manuals being borrowed by the borrower when he keys in his employee number. Next, he would key in the technical manual number and it would be added to the list. When the technical manuals were returned to the library, the librarian would key in the technical manual number into the system. The system would display a list of manuals returned for that day as verification. If the manuals were not found in the list, there would be a prompt. In the past, borrowers would have to write his particulars into a log book of loans every time he loans a technical manual which would be a hassle when searching for the record if the need arises. Furthermore, it would be impractical to keep folders of hardcopy records for archiving as it would be space consuming. Focus on this chapter would be on the user friendliness design. The application would allow technicians amateur in using a computer to be able to use the system easily. All the technicians need to do to borrow technical manuals would be via a click of a mouse button and using a scanner to scan his employee pass and technical manual barcode. For returning manuals, a click of a mouse button and scanning of the technical manual barcode would be required. 24 4.2 New Loan Record 4.2.1 Using Sub Forms Sub forms were used when they had a different data source from the main form but have a matching field. For example, an employee borrowed a few books and had to be displayed as a list on the sub form. Fig 4.2.1.1 Create a sub form The method was to link the two forms by Child Fields and Master Fields. These would be automatically set when dragging a form to the main form. The form that was being dragged into the main form becomes the sub form. For example, employee number was matched between the two forms. If the main form displayed that particular employee, the sub form would show that particular employee previous loan records. 25 4.2.2 Borrower Friendly Design Fig 4.2.2.1 Create a user friendly design User friendliness design could be challenging to an extent when users had no training of how to use the program. However, a little and short instruction should be able to help users use the program. In Fig 4.2.2.1, ‘Loan Another’ allowed users to loan another technical manual without having to scan in his employee number again. Arranging the tab order was the key to involve user friendliness. When the user scan his employee pass, he would need to scan the technical manual barcode as the cursor automatically move to the next field. The unbound field could be hidden from user view and be used as a buffer to store the employee number for use later on when the user borrows another technical manual. 26 4.2.3 Clean Records Fig 4.2.3.1 Deleting null values Borrowers sometimes made a mistake and a blank record as inserted into the table. It would be necessary to create a macro that cleans up the null data. 4.3 Return of Manual 4.3.1 Design Methods There were many ways to design this page. One was to allow employees to scan the technical manual barcode and a confirmation page was displayed. However, with the confirmation page, it was not sufficient enough to inform the user that the technical manual was returned. As such, a list of returned manuals for him would be displayed to the user instead. 27 Fig 4.3.1.1 Design of return technical manual page Since the standard way of returning books to a library was that the borrower only needed to return the books to the counter. A displayed list of returned technical manuals for the day would be sufficient for the librarian, as the borrower’s pass was not needed to return books. 28 Chapter 5: Roster Database System 5.1 Background, Purpose and Scope It is important to have all employee details to be kept into a database for generating several other databases that serve different purposes. This main database should be closely guarded to prevent confidential data from being leaked out but at the same time, allowing data to be updated to several other databases that share the same information. For example, the Library Loans System and the AC Holder Test required some of the employee’s details. If there were any update in the main database (Roster Database System), all other databases would need to automatically share the same update. Manually changing all other databases’ data would be a hassle and would not be practical. However, this would also mean a risk in confidential data being leaked out due to the existence of separate departments with no proper authorization. One solution would be to get the employee’s consent for their data to be used across databases owned by other departments so they would not need to always provide their particulars every time. The administrator would be able to key in all particulars of an employee and generate all kinds of reports, with data categorized or grouped, for all employees as well as for individual employees. This chapter would focus on the different types of report generation styles and techniques, each for a different purpose. 29 5.2 Report Viewing Methods 5.2.1 Order by Fig 5.2.1.1 Preparing a ‘Order by’ Report Firstly, the query was created first to give the result output list with the ascending stamp number set. Next, the report was created with the result query as the data source. In the third step, the macro was created to allow the report to be opened when being activated. Lastly, the ‘On Click’ property of the created button was set to run the selected macro when the button was clicked. 30 5.2.2 Group by Fig 5.2.2.1 Preparing a ‘Group by’ Report Sometimes, a report would be needed based on a particular category, say ‘Electrical Dept’ for example. On the form, a combo box would need to be created. The drop list would contain the different departments to select from. The ‘On Click’ property of the button was set with a macro to make the combo box appear when the button was clicked and disappear when the button was clicked again. This function might prove useful to prevent the screen from filling up with too many things at one go. 31 Fig 5.2.2.2 Macros to prepare for the ‘Group by’ Report Fig 5.2.2.2 showed how the macros were created. For the top macro, visibility was set to true for the combo box with the condition that its visibility status was false and the macros would be stopped. If the combo box visibility status were initially true, then the visibility of the combo box would be set to false. The bottom macro in Fig 5.2.2.2 would open the report with the condition that the results shown in the report would be the records with the selected department from the combo box. 32 5.2.3 Search by Fig 5.2.3.1 Preparing a ‘Search by’ Report A list of data could be tedious to key into the combo box. As such, the list of data could be extracted from the table. The figure numbered ‘1’ in Fig 5.2.3.1 showed that the row source type selected was ‘Table/Query’ and the row source field was ‘SELECT Roster.Stamp_no FROM Roster ORDER BY Roster.Stamp_no;’. However, this appeared only after the button with the three dots was clicked on and some query settings were made as shown in the figure numbered ‘2’ in Fig 5.2.3.1. 33 5.3 Keeping track of Last Update Fig 5.3.1 Updating Last Update When the ‘Save Record’ button was clicked on, it would activate a macro to execute the ‘Update Last Update Query’ query. This in turn would update the date in a table and would be used at the bottom of the report where its data source would be taken from a query; in this case it was the ‘Roster Category Query sort by Stamp’. 34 Chapter 6: Approved Certified Holder Database System 6.1 Background, Purpose and Scope All technicians would have a long career path ahead of them. Therefore, they would want to have some form of job security and self achievement. In order to sustain their position, they would need to undergo training. As such, it would be important to plan their training schedule to upgrade their skills for more important and tougher jobs. Keeping track of all personnel qualifications and their training progress could be quite a tedious task. This system would be able to automatically execute these tasks and prompt the administrator accordingly. The administrator would key in the required employees’ particulars and the system would operate automatically to assign employees to their training program and to keep track of their progress. This system would also allow the administrator to check expiry of an employee’s certification or quarantine employees to disband them from training temporarily. At the end of the year, the administrator would generate the reports via a click of the button. At the moment in time though, the Training Database System was not integrated with the AC Holder Database System as they were both situated in different departments and not authorized to be integrated with each other yet. The Training Database System would keep track of employee’s training program. The AC Holder Database System would keep track of employee’s certifications. This chapter focuses on the manipulation of a single record and the prompting when an expiry date is reached. 35 6.2 Manipulating Records 6.3.1 Deleting Single Record On a form, every entry would sometimes need to be individually deleted. Fig 6.3.1.1 Snap shot of a form with many entries A button should be created on the form at each record at design level. Fig 6.3.1.2 Setting button properties in design view A macro was assigned to the button’s ‘On Click’ property. 36 Fig 6.3.1.3 Creating the delete macro Fig 6.3.1.3 showed how the delete macro was created. The record was selected first and then deleted. 6.3.2 Detecting overdue and prompting Fig 6.3.2.1 Query Design using totals A query was created to count the number of employees who were in the ‘stpExpDate’ query table of which ‘no. of days to expiry’ was 0 or less. The query result returned a value, which would be use for detection purpose. 37 Fig 6.3.2.2 Creating forms with Query as Data source The form’s data source pointed to the query ‘CountOfExpiringStamps’ was created so the macro would be able to detect the name of the text field ‘CountOfstpNo’. Fig 6.3.2.3 Creating macro to detect expiry and prompt This macro was set in the ‘On Load’ property in the main form. When the macro was activated. ‘CountOfExpiringStamps’ form was loaded carrying a value in the text field named ‘CountOfstpNo’. A message box would prompt ‘Expiry of Stamps Detected’ when condition of ‘[CountOfstpNo]>0’ was met. The form was then closed without being opened as the macro was not set in the ‘On Open’ property in the main form. 38 Chapter 7: Swift Database System 7.1 Background, Purpose and Scope A price gauge would be needed to charge the customers for aircraft parts repair. Swift Database System would serve that purpose of quoting a perfect price for the customer to pay for the repair service. This System was done using Microsoft Excel. Lots of relevant data were to be gathered to justify the price. Statistics were generated in the form of pivot tables to decide the charging price. As such, bouncing related fields across tables, conjuring up formulas in fields and automatic generation of the pivot tables were required for results to process efficiently. The technician would need to key in the data into certain fields and buttons would need to be created so when they are being clicked on, it would activate certain macros. Macros in excel were different from the macros used in Microsoft Access 2000. In Excel, macros would require record of your actions whereas in Access, the appropriate functions would need to be chosen with the mouse. Although this system can be done by Microsoft Access 2000, the employees were already used to using Microsoft Excel. It would take quite a period of time and some difficulty to train all employees in Microsoft Access 2000 as some employees are either too busy with their current work load or simply unreceptive to differences from their current practices. This chapter concentrates on the VLookUp techniques for bouncing purposes, the recording and activation of macros and certain formulas to manipulate data in fields. 39 7.2 Functions 7.2.1 VLookUp VLookUp in Microsoft Excel was used to match data between two or more fields. Fig 7.2.1.1 Example of VLookUp Fig 7.2.1.1 showed two tables consisting of 3 columns each. The first columns of each table were the list of inventory. The second column was all ‘ yes’ data for the VLookUp field to copy the data from when there was a match. The two tables were bounced against each other for matched data. The third column consisted of VLookUp fields where the VLookUp formula resided. A ‘yes’ indicated a match was found whereas a ‘N/A’ indicated a no match found. 40 Fig 7.2.1.2 Example of Setting up VLookUp Look up value was E2, which meant the data in column E, row 2 was to be matched with table array A1: B5. In the table array field, ‘A1: B5’ meant ‘from column A, row 1 to column B, row 5’. A1: B5 could be replaced by A: B, which meant column A and B. Column index was 2, which indicated the corresponding value of the field in column 2 of the table array would be copied to the G2 field when there was a match. Explanation of range lookup was as described on Fig 7.2.1.2. 41 7.2.2 Recording Macros To create a macro in Excel, the only way would be to record a macro. Fig 7.2.2.1 Record a Macro After a task has been completed (for example, the deletion of a pivot table), stop recording the macro and save the macro. This macro could be later assigned to a custom created button or assigned immediately to a shortcut key. As the user’s actions were recorded, Excel interpreted them into Visual Basic codes. However, there was one downside of this function. When I assigned the macro to a button created on a worksheet, actions that were required on another worksheet to delete a pivot table would not work out and an error message was prompted. 42 7.2.3 Removing Spaces and Dashes in the Data It was sometimes difficult to manipulate the data in the field to a certain format. When there was no option for these special formatting, there would be a need to use formulas and techniques. Removing spaces The method to remove all spaces in any fields was to highlight the selected fields and press ‘ctrl-h’ (find and replace function). Fill in the ‘Find’ field with a spacebar and do not fill anything in the ‘Replace’ field. For example, before executing the method, the data in the field was ‘a b c’. After executing the method, the data in the field was ‘abc’. This would be a better method than going through field by field to remove the space in between letters. Removing Dashes The formula for removing any numbers after the dash was: =IF(LEN(A:A)-LEN(SUBSTITUTE(A:A,”-“,””))>0,LEFT(A:A,FIND(“*”,SUBSTITUTE(A:A,”-“,”*”,LEN(A:A)-LEN(SUBSTITUTE(A:A,”“,””))))-1),A:A) LEN( ) returned the length of the data in the field. SUBSTITUTE(A: A, “-”,””) substituted “-” with “” from column A to column A. LEFT(‘X’, ‘Y’) returned ‘Y’ number of letters from the word ‘X’ starting from the left. For example, a field in column A contained the data ‘456-789’. A field in column B contained the formula and the result of ‘456’ was displayed. 43 7.2.4 Pivot Tables Fig 7.2.4.1 Example of a Pivot Table A pivot table could count the number of times a data from a field appeared corresponding to the data from another field. It could also show sum or average. Fig 7.2.4.2 Procedure to create Pivot Table Fields from the table were selected for display on the Pivot Table as shown in Fig 7.2.4.2. 44 7.2.5 Siphoning Data from Commas Fig 7.2.5.1 Text to Columns Function The fixed width option allowed dividing the data where as the user wishes. The delimited option allowed dividing the data only at specific places as shown in Fig 7.2.5.1. 45 Chapter 8: Inventory Bouncing System 8.1 Background, Purpose and Scope Inventory checking was one of the frequented triggered jobs in the company. It was a practice where two or more lists of data were bounced against each other for a list of unmatched data. For example, a list of missing technical manuals was needed to be generated for a report and this would be done by bouncing the system’s inventory against the existing physical inventory. Microsoft Access 2000 was the program to use to serve this purpose perfectly. Besides using Microsoft Access 2000 to execute this job, this exercise could be done by Microsoft Excel’s VLookUp function too. Although Microsoft Excel’s VLookUp allowed inventory bouncing, achieving the output result required some extra setup with the VLookUp and filtering function every time. The result produced was not the same as the Microsoft Access 2000 inventory bouncing method where a list of unmatched data was generated by the Unmatched Query function. Sometimes, looking for similarities between two or more lists of data would be required. As such, executing the matched query would be appropriate in this case. In Microsoft Access 2000, executing the unmatched query would be required for the second time. For Example, between the system’s inventory and the missing technical manual’s list. This chapter explains how to execute inventory bouncing using Microsoft Access 2000. The focus would be on the theory, finding unmatched and matched query. 47 8.2 How it works 8.2.1 Theory and Example Let us use an example of library inventory check. Fig 8.2.1.1 Venn Diagram of Inventory Bouncing ‘System’s Library Inventory’ referred to the technical manuals that were registered into the system. ‘Scanned Library Inventory’ referred to the physical technical manuals on the shelves that were scanned into an excel file. When the ‘System’s Library Inventory’ was bounced against ‘Scanned Library Inventory’ using the ‘Find Unmatched Query’ in Microsoft Access 2000, the result list produced was the area marked ‘Missing Library Inventory’ as shown in Fig 8.2.1.1. When ‘Scanned Library Inventory’ was bounced against ‘System’s Library Inventory’ using the ‘Find Unmatched Query’ in Microsoft Access 2000, the result list produced was the area marked ‘Scanned Library Inventory not registered in System’. To attain the result of the area marked ‘Not Missing Library Inventory’, ‘System’s Library Inventory’ was bounced against ‘Missing Library Inventory’ using the ‘Find Unmatched Query’ in Microsoft Access 2000. 48 8.2.2 Finding Unmatched Inventory Fig 8.2.2.1 Importing External Data The first step was to import the two tables from excel as the employees were used to keying data into excel. When the tables were imported, it was essential that the first row contained the names of the fields for convenience in the bouncing process. Fig 8.2.2.2 Creating Find Unmatched Query When executing the ‘Find Unmatched Query’, the first table selected would be bounced against the selected second table with at least one matching field. 49 Fig 8.2.2.3 Example Table Results of Inventory Bouncing The top two tables in Fig 8.2.2.3 were bounced against one another two produce two different resulting query tables as shown at the bottom in Fig 8.2.2.3. 50 Chapter 9: Summary and Conclusion 9.1 Summary Each of these applications we have covered so far were created using Microsoft Access 2000. Microsoft Excel could be used together with Microsoft Access to complement each other’s functionality. AC Holder Test allowed technicians to sit for their test electronically. The system would automatically generate the papers, mark the papers and generate the results report. Furthermore, the AC Holder Database System kept track of the trainee’s training progress and their qualifications. Library Loans System kept track of the loaning out of technical manuals as technicians borrow and return them to the library. The Inventory Bouncing System made sure that missing technical manuals would be located and returned to its rightful location. Incident Reporting System allowed employees to highlight any incidents that require attention discovered in the surrounding environment and build a team to solve them. Lastly, the Swift Database System helped to determine the quoting price for a customer. Database Systems that had an employee table was linked to the Roster Database System’s employee table which contained all employee data. We had also looked into the important uses of macros and queries that drive the application processes. The security features that the Microsoft Access 2000 had were also implemented to prevent accidental modification to the database system. 51 9.2 Conclusion We have seen the usefulness of Microsoft Access 2000. There is no doubt future programs like this would be more efficient. It is possible to create applications like an Online Test with Microsoft Access 2000. Examinees take the test from different computers and their answers as well as scores are archived into the database file in another part of the network. Macros and queries play a big part of the process which drives the application. As such, an application like an Online Test can be built solely on the use of Macros with no need to write lots of long codes. However, if the need arises to convert the Macros to codes, Microsoft Access 2000 can fulfill this function. Moreover, the software is built by the Visual Basic programming language. This would allow the application to be integrated with other programs whenever required. Applications such as the Online Test allow many man hours to be saved. In the past, examiners would have to manually prepare the paper questions, mark paper by paper and tabulate reports. With the present technology, generating random questions for each individual, automatic marking and report generation with a click of a button is nothing more of a mere hassle. The future does not stop here. Newer and more powerful programs would allow commoners to program their own applications with greater ease than before. 52 References Books Microsoft Access 2000 – T.T. Flynn Access Macros & Switchboards - Wayne Wilmeth Microsoft Excel 2000 – Philip A. Koneman Websites Microsoft Access Database Programming - http://www.blueclaw-db.com/ Access Macros & Database Utilities - http://oit.wvu.edu/training/classmat/db/ 53