⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch08.htm

📁 Microsoft_Access_97_Quick_Reference.zip
💻 HTM
📖 第 1 页 / 共 5 页
字号:
			<BLOCKQUOTE>
			<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT> As an alternative to creating <I>global</I>
			keyboard shortcuts, you can create keyboard shortcuts for each <I>form</I>. In the
			<I>Caption</I> <I>property</I> of a button or of a <I>label</I> attached to another
			control, type an ampersand (<B>&amp;</B>) before the letter you want to be the shortcut.
			Then pressing Alt+<I>the letter</I> is the same as clicking the option. 
<HR>


			</BLOCKQUOTE>

			<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
			<OL>
				<B>1.</B> Select a macro group in the Database window and choose <U>D</U>esign (or
				create a new macro and the actions to be called with shortcut keys).
				<P><B>2.</B> Type the keyboard representation in the Macro Name column in the first
				row of the macro (to the left of where the macro actions start). Use a caret (^)
				to represent Ctrl and plus (<B>+</B>) to represent Shift. Include function keys and
				edit keys in curly braces such as <B>{F1}</B> or <B>{Delete}</B>. <B>^p</B> would
				mean Ctrl+P.</P>
				<P><B>3.</B> Repeat Step 2 to add more keys.</P>
				<P><B>4.</B> Choose <U>F</U>ile, Save <U>A</U>s/Export to save the macro group, type<B>
				AutoKeys</B> in the New Name text box, and choose OK. Close the macro group.
			</OL>
			<H2><FONT COLOR="#000077"><B>Macros: Save as VBA Module</B></FONT></H2>
			<P>There has been some speculation whether Microsoft will continue to have macros
			in future versions of Access (see <I>Special Edition Using Microsoft Access 97</I>
			by Roger Jennings). According to Jennings, macros are only used for backward compatibility
			and probably will not be included in the next version of Access. Therefore, he recommends
			that you work entirely in <I>VBA</I>. To ease the transition, you can create a <I>macro</I>
			and then save it as a VBA <I>module</I>.
			<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
			<OL>
				<B>1.</B> In the <I>Database window</I>, select a macro. You can also have the macro
				open in <I>Design View</I>.
				<P><B>2.</B> Choose <U>F</U>ile, Save <U>A</U>s/Export.</P>
				<P><B>3.</B> In the File Save As <I>dialog box</I>, click Save as Visual Basic <U>M</U>odule
				and choose OK.</P>
				<P><B>4.</B> In the Convert Macro dialog box, choose whether you want to add error
				handling and add comments, and choose <U>C</U>onvert.
			</OL>
			<P>Your converted macro is now listed on the Modules tab of the Database window.
			To rename the module, right-click and choose Rena<U>m</U>e from the shortcut menu.
			If what you converted was a macro <I>group</I>, each macro is a separate procedure
			in the module.
			<H2><FONT COLOR="#000077"><B>Macros: Set Conditions</B></FONT></H2>
			<P>While you are working with macros, there are cases when you want to run one action
			if one condition exists and another action if another condition exists. For example,
			you can create a <I>dialog box</I> that prompts the user before a <I>report</I> is
			generated or create alphabetical <I>filter</I> buttons on a <I>form</I>.
			<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
			<OL>
				<B>1.</B> In the Database window, click the Macro tab and choose <U>N</U>ew.
				<P><B>2.</B> If the Conditions column is not visible, click the Conditions button
				on the toolbar.</P>
				<P><B>3.</B> Type an <I>expression</I> in the Conditions column in the first row
				of the <I>macro</I>. Remember to include <I>field</I> names in square brackets. If
				you want to include more complex conditions, you can click the Build button.</P>
				<P><B>4.</B> Create the macro action and its <I>arguments</I> on the same line as
				the condition. The action will run if the condition evaluates to <TT>True</TT>. If
				you want more than one action to run, include three periods (<B>...</B>) in the next
				row(s) in the Conditions column and choose the action(s).</P>
				<P><B>5.</B> On the next row (without ...), include any action you want to run if
				the condition evaluates to <TT>False</TT>.</P>
				<P><B>6.</B> Click the Save button to save the macro, give it a name (if you haven't
				already), and choose OK.
			</OL>


			<BLOCKQUOTE>
			<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT> If you always want the Conditions column
			to appear by default, choose <U>T</U>ools, <U>O</U>ptions; click the View tab; and
			choose Co<U>n</U>ditions Column. 
<HR>


			</BLOCKQUOTE>

			<H2><FONT COLOR="#000077"><B>Menu: Create Custom</B></FONT></H2>
			<P>A menu bar contains the words that appear under the title bar of your application.
			The default menu bar starts with File and ends with Help. Each menu drops down from
			one of the words on the menu bar (the File menu and Help menu). When you create an
			application for someone else to use, you can limit menu options and toolbars to make
			the job easier for the user or to help the user avoid getting in trouble. You can
			attach menu bars and toolbars to forms and reports and have a menu appear at startup
			as well.


			<BLOCKQUOTE>
			<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT> In Access 95 and Access 2, you could use
			the Menu <I>Builder</I> to create menu bars. In a <I>form</I> or <I>report</I>, go
			to the Menu Bar <I>property</I> and click the Build button. 
<HR>


			</BLOCKQUOTE>

			<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
			<OL>
				<B>1.</B> Choose <U>V</U>iew, <U>T</U>oolbars, <U>C</U>ustomize; click the Tool<U>b</U>ars
				tab; and choose the <U>N</U>ew <I>command button</I>.
				<P><B>2.</B> Type the name of the menu bar in the New Toolbar <I>dialog box</I> and
				choose OK. If necessary, drag the title bar of the Customize dialog box to see the
				new menu/toolbar.</P>
				<P><B>3.</B> On the Customize dialog box, the <I>focus</I> should be on your new
				toolbar name. Choose the Properties command button and change the Typ<U>e</U> to
				Menu Bar. To have your menu bar be a shortcut menu, choose Popup. When finished choose
				Close.</P>
				<P><B>4.</B> Click the Commands tab of the Customize dialog box. To put one of Access'
				menus on your menu, choose Built-in Menu in the Cate_gories list and drag one of
				the menus from the Comman<U>d</U>s list onto your menu. To create your own menu,
				choose New Menu from the Cate_gories list and drag New Menu from the Comman<U>d</U>s
				list onto your menu.</P>
				<P><B>5.</B> To change the menu name (or item on the menu), right-click the name
				and type the new menu name or menu item name in the shortcut menu's <U>N</U>ame box.
				To add a hotkey, type an ampersand (<B>&amp;</B>) before the letter. For menu items,
				you can also change the button image that appears next to the menu item or choose
				just to have the text appear.</P>
				<P><B>6.</B> To add or delete items from one of your menus on the menu bar, click
				the menu to first open it. Drag items off. To add items, drag them from the Comman<U>d</U>s
				list in the Customize dialog box. When finished, choose Close in the Customize dialog
				box.
			</OL>
			<P>To have this menu appear as the default menu for your application, see &quot;Menu:
			Startup.&quot; To add this menu to a form or report, see &quot;Menus and Toolbars:
			Add to Form/Report.&quot;


			<BLOCKQUOTE>
			<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT> If you are creating a shortcut menu, you
			need to check the Shortcut Menus item in the Toolb<U>a</U>rs list of the Customize
			dialog box to display the shortcut menu bar with your menu name (and others) in order
			to add or remove items. 
<HR>


			</BLOCKQUOTE>

			<H2><FONT COLOR="#000077"><B>Menu: Startup</B></FONT></H2>
			<P>If you want your <I>database</I> application to start with a menu other than the
			default Access menu, you can choose a menu you've already created. The first step
			is to create the menu. (See &quot;Menu: Create Custom.&quot;)
			<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
			<OL>
				<B>1.</B> Choose <U>T</U>ools, Start<U>u</U>p.
				<P><B>2.</B> In the <U>M</U>enu Bar drop-down list, pick your menu.</P>
				<P><B>3.</B> If you do not want Access' menu bars visible (when you open any <I>object</I>
				or go to <I>Design View</I>), uncheck Allow F<U>u</U>ll Menus.</P>
				<P><B>4.</B> You can also choose another menu for the shortcut menu in the <U>S</U>hortcut
				Menu Bar <I>list box</I> and uncheck Allow <U>D</U>efault Shortcut Menus.</P>
				<P><B>5.</B> When finished with all choices, choose OK.
			</OL>


			<BLOCKQUOTE>
			<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT> If you uncheck Allow F<U>u</U>ll Menus
			in Step 3, the next time you open your database, Access' menus will not be available.
			If you need access to the default menus (such as going back to the Startup <I>dialog
			box</I>), hold down Shift as you open your database to override the Startup options.
			
<HR>


			</BLOCKQUOTE>

			<H2><FONT COLOR="#000077"><B>Menus and Toolbars: Add to Form/Report</B></FONT></H2>
			<P>When you design an application for other users, generally you have a startup switchboard
			<I>form</I> (see &quot;Controls: Command Button Create&quot; in the Forms and Reports
			part of this book) to add buttons that will make your switchboard. In addition to
			the buttons on the form itself, you can add a menu and toolbar that are different
			from the Access default choices. You can add a menu and toolbar to any form or <I>report</I>
			through properties. To accomplish this procedure, you must first create a menu or
			a toolbar. (See &quot;Menu: Create Custom&quot; and &quot;Toolbar: Create Custom.&quot;)
			<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
			<OL>
				<B>1.</B> Open the form or report in <I>Design view</I> and double-click the Form/Report
				selector to open the <I>Property</I> sheet.
				<P><B>2.</B> Move to the Menu Bar, Shortcut Menu, or Toolbar property (on the Other
				tab) and type or choose the name of your menu or toolbar from the drop-down list.
			</OL>


			<BLOCKQUOTE>
			<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT> To see or change which menus or toolbars
			are available for form or report menu bars, shortcut bars, or toolbars, choose <U>V</U>iew,
			<U>T</U>oolbars, <U>C</U>ustomize; select your toolbar or menu on the Tool<U>b</U>ars
			tab; and click the Properties command button. Choose one of the items on the Typ<U>e</U>
			<I>combo box</I>. Use Popup for shortcut menus. 
<HR>


			</BLOCKQUOTE>

			<H2><FONT COLOR="#000077"><B>Optimization: General Suggestions</B></FONT></H2>
			<P>Because Access writes all of its data and design to a single file, as data and
			objects are deleted and created, free space and fragmented data structures are created.
			This is similar to what happens with your computer's file system. Over time, the
			<I>database</I> file grows larger than it needs to be and performance can suffer.
			To optimize performance, you can compact the database. Doing so creates a new file
			where all of the data is stored efficiently and in sequence.
			<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
			<OL>
				<B>1.</B> Save any design changes for any open object (form, report, and so on) you
				have been working on.
				<P><B>2.</B> To compact a database, choose <U>T</U>ools, <U>D</U>atabase Utilities,
				<U>C</U>ompact Database.
			</OL>


			<BLOCKQUOTE>
			<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT> To compact the current database, see the
			topic &quot;Database: Compact&quot; in the File Management part of this book. 
<HR>


			</BLOCKQUOTE>

			<H3><FONT COLOR="#000077"><B>Additional Ways to Optimize Your Database</B></FONT></H3>
			<P>Compacting the database is just one of many ways you can improve the performance
			of your database (See also other Optimize tasks in this section). Some additional
			options for optimizing the performance of a database include:
			<UL>
				<LI><I>Running in Exclusive mode. </I>You can run the database in Exclusive mode
				by setting that <I>check box</I> in the Open <I>dialog box</I> when you open the
				database.
				<P>
				<LI><I>Installing to a hard drive. </I>You can install the database file to a local
				hard drive instead of a network <I>server</I>.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -