home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 6 / 06.iso / a / a560 / 8.ddi / PSSKB.TX$ / PSSKB.bin
Encoding:
Text File  |  1993-01-03  |  22.1 KB  |  590 lines

  1. ----------------------------------------------------------------------      
  2.                  ANSWERS TO COMMONLY ASKED QUESTIONS
  3. ----------------------------------------------------------------------
  4.  
  5. TABLE OF CONTENTS
  6.  
  7. 1   What other data formats does Microsoft Access support?
  8. 2   How many databases can I open at once?
  9. 3   What are primary and foreign keys in a relational database?
  10. 4   How can I change the starting value of a Counter field?
  11. 5   How can I create calculated fields in tables?
  12. 6   Is data stored in a sorted order in a table? How can I view
  13.     my data in sorted order?
  14. 7   Can I join tables from different databases in one query?
  15. 8   How can I check for Null fields using a query?
  16. 9   What is the difference between DISTINCT and DISTINCTROW?
  17. 10  How do I invoke my Access Basic code from within a form?
  18. 11  Do form rules override table rules?
  19. 12  When do I use the ! operator and when do I use the . (dot) operator?
  20. 13  How can I prevent a field from being included in the tab order?
  21. 14  Why doesn't the header I created show in my form on the screen?
  22. 15  When are validation rules on a form evaluated?
  23. 16  How can I ensure that a field on a form is not left blank?
  24. 17  How can I refer to a control on a subform?
  25. 18  How can I change the behavior of the cursor when I tab into a field?
  26. 19  How can I convert a form to a report?
  27. 20  How can I sort the data in a report on a field from another table?
  28. 21  When I print my report, every other page is blank. What causes this?
  29. 22  How can I undo changes to the current field or record?
  30. 23  How can I analyze the structure of my database?
  31.  
  32.  
  33. Question 1
  34.  
  35. What other data formats does Microsoft Access support?
  36.  
  37. Answer 1
  38.  
  39. Microsoft Access can link to dBASE III+, dBASE IV, Paradox version 
  40. 3.x, and Btrieve data (all including corresponding indexes). 
  41.  
  42. Microsoft Access can import data from FoxPro version 2.x, dBASE III+, 
  43. dBASE IV, Paradox version 3.x, Lotus 1-2-3 version 2.x, Lotus 1-2-3 
  44. version 3.x, Lotus 1-2-3/W, Microsoft Excel version 2.x and later, 
  45. and Btrieve.  It can also import fixed-length and delimited ASCII text.
  46.  
  47. Microsoft Access also supports the Open Database Connectivity (ODBC) 
  48. specification for connectivity to data on database servers.  The 
  49. Microsoft SQL Server ODBC driver is the only driver certified for 
  50. version 1.0 and is included in your Microsoft Access package.
  51.  
  52. For more information on data formats supported by Microsoft
  53. Access, see Chapter 4, "Importing, Exporting, and Attaching," in
  54. the Microsoft Access User's Guide.
  55. ---------------------------------------------------------------------
  56.  
  57. Question 2
  58.  
  59. How many databases can I open at once?
  60.  
  61. Answer 2
  62.  
  63. In Microsoft Access, you can open only one database at a time through 
  64. the user interface.  You can, however, use the Attach Table command 
  65. on the File menu to attach to as many databases as memory allows.  
  66. You can also use the Access Basic OpenDatabase function to open several 
  67. databases at once (limited only by memory). For more information on
  68. attaching, see Chapter 4, "Importing, Exporting, and Attaching," in
  69. the Microsoft Access User's Guide. For more information on the
  70. OpenDatabase function, search Help for "OpenDatabase."
  71. ---------------------------------------------------------------------
  72.  
  73. Question 3
  74.  
  75. What are primary and foreign keys in a relational database?
  76.  
  77. Answer 3
  78.  
  79. A primary key uniquely identifies each record in a table and is 
  80. usually a single field containing data that is unique for each record; 
  81. for example, an employee ID number or an order ID number.  A primary 
  82. key can also include more than one field.  For example, in a table 
  83. that contains information about companies that have more than one 
  84. contact, the primary key might include both the Company ID and Contact 
  85. Name fields.  Together, the two fields uniquely identify the record.
  86.  
  87. A foreign key identifies a field or fields in one table that match 
  88. the primary key in another table.  For example, the Employee ID 
  89. field in the Employees table is the primary key, and the Employee 
  90. ID field in the Orders table is a foreign key.
  91.  
  92. For more information on primary and foreign keys, see Chapter 1,
  93. "Designing a Database," or Chapter 2, "Table Basics," in the 
  94. Microsoft Access User's Guide.
  95. ---------------------------------------------------------------------
  96.  
  97. Question 4
  98.  
  99. How can I change the starting value of a Counter field to a number 
  100. other than 1? 
  101.  
  102. Answer 4
  103.  
  104. One way is to create a new, temporary table with just one field, 
  105. a Number field, that has the same name as the Counter field in 
  106. the original table. Enter a value in the temporary table.  This 
  107. value should be 1 less than the desired starting value for the 
  108. Counter field in the original table.  Create an append query to 
  109. append the record from the temporary table to the original table.  
  110. After you append the record, delete the temporary table, and then 
  111. delete the dummy record from the original table.
  112.  
  113. NOTE:  Don't compact the database before adding the first record 
  114. to the original table; if you do, the Counter value will be reset 
  115. to start at 1.
  116. ---------------------------------------------------------------------
  117.  
  118. Question 5
  119.  
  120. How can I create calculated fields in tables?
  121.  
  122. Answer 5
  123.  
  124. In general, it helps to think of queries as tables.  You can use 
  125. a query whenever you can use a table.  To add a calculated field 
  126. to a query, open the query in Design view and enter an expression 
  127. in the Field row in the QBE Grid. If you're familiar with Microsoft 
  128. SQL Server terminology, using a query in this way is very similar 
  129. to creating a VIEW.  Unlike most implementations of views, however, 
  130. Microsoft Access views are generally updatable even if they involve 
  131. joins from disparate data sources. To learn more about when queries
  132. are updatable, see Chapter 6, "Designing Select Queries," in the
  133. Microsoft Access User's Guide.
  134. ---------------------------------------------------------------------
  135.  
  136. Question 6
  137.  
  138. Is data stored in a sorted order in a table?  How can I view my 
  139. data in sorted order?
  140.  
  141. Answer 6
  142.  
  143. No.  Data is stored in the order in which it is entered.  To 
  144. view data in sorted order, create a query, add the field you 
  145. want to sort on to the QBE grid, and then select Ascending or 
  146. Descending in the Sort row for that field. For more information,
  147. see Chapter 5, "Query Basics," in the Microsoft Access User's Guide.
  148. ---------------------------------------------------------------------
  149.  
  150. Question 7
  151.  
  152. Can I join tables from different databases in one query?
  153.  
  154. Answer 7
  155.  
  156. Yes.  You can use the Attach Table command on the File menu to 
  157. attach to tables in separate databases, and then create joins 
  158. in the Design view of the Query window. For more information
  159. on attaching, see Chapter 4, "Importing, Exporting, and Attaching,"
  160. in the Microsoft Access User's Guide. For information on creating
  161. joins in the Query window, see Chapter 5, "Query Basics."
  162. ---------------------------------------------------------------------
  163.  
  164. Question 8
  165.  
  166. How can I check for Null fields using a query?
  167.  
  168. Answer 8
  169.  
  170. Place the expression "Is Null" in the Criteria row of the QBE grid.
  171. For more information, search Help for "IsNull."
  172. ---------------------------------------------------------------------
  173.  
  174. Question 9
  175.  
  176. What is the difference between DISTINCT and DISTINCTROW?
  177.  
  178. Answer 9
  179.  
  180. DISTINCT is a reserved word in ANSI SQL (as well as Microsoft 
  181. Access SQL) and causes a query to return unique data, as opposed 
  182. to unique records.  For example, if 10 customers are named Jones, 
  183. a query based on the SQL statement "SELECT DISTINCT Name FROM 
  184. Customers" returns only one record with Jones in the Name field.  
  185. In Microsoft Access queries, you specify DISTINCT by selecting the 
  186. Unique Values Only check box in the Query Properties dialog box.
  187.  
  188. In contrast, DISTINCTROW is unique to Microsoft Access.  It causes 
  189. a query to return unique records, not unique values.  For example, 
  190. if 10 customers are named Jones, a query based on the SQL statement 
  191. "SELECT DISTINCTROW Name FROM Customers" returns all 10 records with 
  192. Jones in the Name field.
  193.  
  194. The major reason for adding the DISTINCTROW reserved word to Microsoft 
  195. Access SQL is to support updatable semi-joins, such as one-to-many 
  196. joins in which the output fields all come from the table on the "one" 
  197. side.  DISTINCTROW is specified by default in Microsoft Access 
  198. queries and is ignored in queries in which it has no effect. You
  199. should not delete the DISTINCTROW reserved word from the SQL dialog
  200. box.
  201. ---------------------------------------------------------------------
  202.  
  203. Question 10
  204.  
  205. How do I invoke my Access Basic code from within a form?
  206.  
  207. Answer 10
  208.  
  209. To call a function from a property, open the form in Design view 
  210. and type the name of the function in the property sheet as follows: 
  211.  
  212.  =<function_name>()
  213.  
  214. The equal sign (=) and parentheses are required. You can call an 
  215. Access Basic function from form or control properties such as 
  216. AfterUpdate and DefaultValue.  You cannot call Sub procedures 
  217. from properties.  For more information, search Help for 
  218. "properties: calling macros and functions" or see Chapter 7,
  219. "Coding with Forms," in Microsoft Access Basic: An Introduction 
  220. to Programming.
  221. ---------------------------------------------------------------------
  222.  
  223. Question 11
  224.  
  225. Do form rules override table rules?
  226.  
  227. Answer 11
  228.  
  229. Yes.  Note, however, that when you create a control on a form 
  230. by dragging a field from the field list, the control inherits 
  231. the field's ValidationRule property setting, which is defined 
  232. in the table's Design view.
  233.  
  234. For information on setting field properties, see Chapter 3,
  235. "Changing and Customizing Tables," in the Microsoft Access
  236. User's Guide. For information on setting control properties, 
  237. see Chapter 9, "Designing Forms."
  238.  
  239. ---------------------------------------------------------------------
  240.  
  241. Question 12
  242.  
  243. When is it appropriate to use the ! (exclamation point) operator 
  244. versus the .(dot) operator when identifying objects and properties 
  245. in an expression such as Forms!Form1.Visible?
  246.  
  247. Answer 12
  248.  
  249. A good rule of thumb is to use the ! operator to the left of the 
  250. name of anything you create (such as a form or a control on the 
  251. form). Use the .(dot) operator to the left of the name of anything 
  252. defined by Microsoft Access (such as a property).
  253.  
  254. For more information on expression syntax, see Appendix C, "Expressions,"
  255. in the Microsoft Access User's Guide.
  256. ---------------------------------------------------------------------
  257.  
  258. Question 13
  259.  
  260. When I lock a field, I usually don't want the insertion point to 
  261. move to that field.  Is there a way to prevent the field from 
  262. being included in the tab order?
  263.  
  264. Answer 13
  265.  
  266. Two control properties affect whether you can change the value in 
  267. a control and whether the control can receive the focus: Locked 
  268. and Enabled.  By default, the Locked property is set to No, and 
  269. for all controls except unbound object frames, the Enabled property 
  270. is set to Yes.  
  271.  
  272. The following table shows all combinations of the different
  273. property settings.
  274.  
  275. LOCKED           ENABLED           BEHAVIOR
  276.  
  277. No               Yes               The control can receive the
  278.                                    focus. Data is displayed
  279.                                    normally and can be copied
  280.                                    and changed.
  281.  
  282. No               No                The control is dimmed and cannot 
  283.                                    receive the focus.  However, the 
  284.                                    field still appears in the form's
  285.                                    Design view when you choose Tab 
  286.                                    Order from the Edit menu.  
  287.  
  288. Yes              No                The control isn't dimmed but you
  289.                                    can't tab into the field.  
  290.  
  291. Yes              Yes               You can tab into the control
  292.                                    but you can't change the value in 
  293.                                    the field.
  294.   
  295. For more information, search Help for "Locked" and "Enabled."
  296. ---------------------------------------------------------------------
  297.  
  298. Question 14
  299.  
  300. Why doesn't the header I created show in my form on the screen?
  301.  
  302. Answer 14
  303.  
  304. A form has two types of headers: form headers and page headers.  
  305. Microsoft Access displays form headers both on screen and when 
  306. the form is printed, but it displays page headers only when the 
  307. form is printed.  The header you created was most likely a page 
  308. header. 
  309. ---------------------------------------------------------------------
  310.  
  311. Question 15
  312.  
  313. When are validation rules on a form evaluated?
  314.  
  315. Answer 15
  316.  
  317. Microsoft Access validation rules operate at the field level. 
  318. A validation rule is evaluated only when data is entered or edited 
  319. in a field and the focus moves to another field or record.  If the 
  320. field is left unchanged, Microsoft Access doesn't evaluate the 
  321. validation rule.  Microsoft Access also validates a field on a form 
  322. when you switch views or close the form.
  323.  
  324. If you want to do record-level validation, you can attach a macro to 
  325. the form's BeforeUpdate property. For more information, see Chapter 22,
  326. "Using Macros with Forms," in the Microsoft Access User's Guide.
  327. ---------------------------------------------------------------------
  328.  
  329. Question 16
  330.  
  331. How can I ensure that a field on a form is not left blank?
  332.  
  333. Answer 16
  334.  
  335. There are several ways to ensure that a field on a form isn't left 
  336. blank or unchanged.  The most effective way is to create a macro 
  337. that uses the IsNull function to check for a value in the field.  
  338. For more information, search Help for "macros: validating data" 
  339. and go to the "Validating Data Using Macros" topic.
  340. ---------------------------------------------------------------------
  341.  
  342. Question 17
  343.  
  344. How do I refer to a control on a subform?
  345.  
  346. Answer 17
  347.  
  348. When you refer to a subform on a main form, you are actually 
  349. referring to the subform control.  To refer to the subform itself, 
  350. use the Form property of the subform control:
  351.  
  352. Forms![main form]![subform].Form![control]
  353.  
  354. For a nested subform, use the following syntax:
  355.  
  356. Forms![main form]![subform].Form![nested subform].Form![control]
  357.  
  358. For more information, search Help for "subforms: referring to
  359. controls on."
  360. ---------------------------------------------------------------------
  361.  
  362. Question 18
  363.  
  364. How can I change the behavior of the insertion point when I tab into a 
  365. field?
  366.  
  367. Answer 18
  368.  
  369. By default, if you use the arrow keys to move to the next field,
  370. the entire field is selected.  To have the insertion point move to
  371. the next character instead of the next field, choose Options from 
  372. the View menu, select Keyboard, and change the setting for Arrow 
  373. Key Behavior from Next Field to Next Character.
  374.  
  375. For more information, search Help for "Options command."
  376. ---------------------------------------------------------------------
  377.  
  378. Question 19
  379.  
  380. How can I convert a form to a report?
  381.  
  382. Answer 19
  383.  
  384. In Design view, choose Save As Report from the File menu.
  385. ---------------------------------------------------------------------
  386.  
  387. Question 20
  388.  
  389. How can I sort the data in a report on a field from a table other 
  390. than the one on which the report is based?
  391.  
  392. Answer 20
  393.  
  394. Create a query that includes the field from the other table, sort 
  395. on the field, and then base the report on the query.  If you have 
  396. already created the report, verify that the query includes all the 
  397. fields used in the report, and then change the report's ControlSource 
  398. property to the name of the query.
  399.  
  400. For more information on creating queries, see Chapter 5,
  401. "Query Basics," and Chapter 6, "Designing Select Queries," in the
  402. Microsoft Access User's Guide. For more information on basing
  403. your report on a query, see Chapter 17, "Report Basics," and 
  404. Chapter 18, "Designing Reports."
  405. ---------------------------------------------------------------------
  406.  
  407. Question 21
  408.  
  409. When I print my report, every other page is blank. What causes this 
  410. problem?
  411.  
  412. Answer 21
  413.  
  414. The width of your report plus the left and right margins should not 
  415. exceed the width of the page (usually 8.5").
  416. ----------------------------------------------------------------------
  417.  
  418. Question 22
  419.  
  420. I've made a change to a record that violates a validation rule or
  421. referential integrity. How can I restore the change so the error 
  422. message box doesn't re-appear?
  423.  
  424. Answer 22
  425.  
  426. Press the Esc key, or choose Undo Current Record from the Edit menu.
  427. ---------------------------------------------------------------------
  428.  
  429. Question 23  
  430.  
  431. How can I analyze the structure of my database?
  432.  
  433. Answer 23
  434.  
  435. Microsoft Access Product Support Services has developed a 
  436. tool called the Database Analyzer, which enables you to print 
  437. structural information about the tables, forms, and other 
  438. objects in your databases. This information can be useful in 
  439. keeping track of fields, controls, and properties in your 
  440. database objects and in diagnosing problems with a database. 
  441. When you call Microsoft Product Support Services, they may ask 
  442. you to load the Analyzer and run an analysis of any database 
  443. objects that are causing problems.
  444.  
  445. If you chose the Complete Installation option when you installed
  446. Microsoft Access, or if you installed the sample applications as
  447. part of a custom installation, the Database Analyzer was copied 
  448. onto your hard disk. Follow the steps in the following procedure 
  449. to load the Analyzer into memory and use it.
  450.  
  451. To load the Database Analyzer:
  452.  
  453. 1 Using Microsoft Windows Notepad or another text editor, open 
  454.   MSACCESS.INI (in your WINDOWS directory), and add the following 
  455.   line under [Libraries]:
  456.  
  457.     analyzer.mda=
  458.  
  459. 2 Save the file, and restart Microsoft Access.
  460.  
  461. 3 Open the database you want to analyze.
  462.  
  463. 4 Click the Macro button in the Database window, and then 
  464.   choose the New button.
  465.  
  466. 5 In the first row, choose RunCode as the action.
  467.  
  468. 6 Type StartAnalyzer() as the Function Name argument 
  469.   for this action.
  470.  
  471. 7 Close the Macro window, saving the macro and naming it 
  472.   "Analyzer."
  473.  
  474. Note: For other databases, copy the Analyzer macro onto the 
  475. Clipboard, open the database, and paste the macro to the list 
  476. of macros in the Database window.
  477.  
  478. Once you load the Database Analyzer, you can use it to analyze a 
  479. single object such as a table, multiple objects (including 
  480. different types of objects at one time), or an entire database.
  481.  
  482. To analyze a table:
  483.  
  484. 1 Open the database.
  485.  
  486. 2 Run the Analyzer macro.
  487.  
  488. 3 In the Database Analyzer, click the Table button.
  489.  
  490.   The list of tables in the database appears in the Items 
  491.   Available box.
  492.  
  493. 4 Double-click one of the tables in the list.
  494.  
  495.   The table moves to the Items Selected box.
  496.  
  497.   You can also use the right arrow button to move a selected 
  498.   object from the Items Available box to the Items Selected 
  499.   box.  Use the left arrow button to remove an object from the 
  500.   Items Selected box.
  501.  
  502. 5 Choose the Analyze button.
  503.  
  504.   In the Select An Output Database dialog box, select the 
  505.   database into which you want to place the tables created by 
  506.   the analyzer. You can place them in the database you are 
  507.   analyzing or in a separate database set up for analyzer tables.
  508.  
  509. 6 Select the database, and then choose OK.
  510.  
  511.   Microsoft Access creates a table listing the table fields and 
  512.   important properties for each field.
  513.  
  514. 7 Close the Database Analyzer, click the Table button in the 
  515.   Database window (or, if you selected a different database, open 
  516.   that database), and then open the table named @TableDetails.
  517.  
  518. With the Database Analyzer, you can:
  519.  
  520. * Analyze any or all of your tables. (Each table structure is 
  521.   appended to the bottom of the @TableDetails table.) 
  522.  
  523. * Analyze all the other objects in your database, creating the 
  524.   tables listed below. You can select and analyze multiple 
  525.   objects at one time. For example, you can analyze all your 
  526.   tables and queries at the same time.
  527.  
  528. * Select the properties you want to include in the analysis.  
  529.   To select properties, choose the Properties button, and move 
  530.   the properties from the Available Properties box to the 
  531.   Selected Properties box.
  532.  
  533. * Print the tables, or create reports produced by the analysis.
  534.  
  535. The table below lists the tables you can create with the 
  536. Database Analyzer. Microsoft Access lists these tables along 
  537. with other database tables in the Database window.
  538.  
  539. Object         Table Name         Contains      
  540. ----------------------------------------------------------------
  541. Table          @TableDetails      List of fields, data types, 
  542.                                   lengths, indexes
  543.  
  544. Query          @QuerySQL          Query's SQL statement
  545.                @QueryDetails      List of fields, data types, 
  546.                                   lengths, and source tables
  547.  
  548. Form           @FormProperties    Form properties
  549.                @FormControls      Controls and selected control 
  550.                                   properties
  551.  
  552. Report         @ReportProperties  Report properties
  553.                @ReportControls    Controls and selected control 
  554.                                   properties
  555.  
  556. Macro          @MacroDetails      Macro actions and arguments
  557.  
  558. Module         @ModuleProcedures  Module procedures and parameters
  559.                @ModuleVariables   Variables declared with a 
  560.                                   DimlanDim statement
  561.  
  562. The Database Analyzer creates temporary tables that increase its 
  563. size. To reduce it, compact it as you would a database. Before you 
  564. compact it, however, you must remove it from memory.
  565.  
  566. To compact the Database Analyzer:
  567.  
  568. 1 Using Microsoft Windows Notepad or another text editor, open 
  569.   MSACCESS.INI (in your WINDOWS directory), and type a semicolon 
  570.   in front of the following line under [Libraries]:
  571.  
  572.         analyzer.mda=
  573.  
  574. 2 Save the file, and restart Microsoft Access.
  575.  
  576. 3 Compact the ANALYZER.MDA file.
  577.  
  578. 4 Open the MSACCESS.INI file again, and remove the semicolon that 
  579.   you typed in earlier.
  580.  
  581. 5 Restart Microsoft Access.
  582.  
  583. (Tip: Instead of compacting the Database Analyzer, you can copy 
  584. the original ANALYZER.MDA file into another directory, and then 
  585. copy that file over the file in the ACCESS directory whenever it 
  586. gets too large.)
  587.  
  588. -----------------------------------------------------------------
  589.  
  590.