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

📄 ch08.htm

📁 Microsoft_Access_97_Quick_Reference.zip
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>

<HEAD>


	<META NAME="GENERATOR" Content="Symantec Visual Page 1.0">
	<META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
	<TITLE>Ch 8 -- Special Features and Programming</TITLE>
</HEAD>

<BODY BACKGROUND="../buttonart/bg1.gif" BGCOLOR="#FFFFFF">

<P>
<TABLE BORDER="0" WIDTH="600">
	<TR>
		<TD WIDTH="80" VALIGN="TOP"><IMG SRC="../buttonart/que.gif" WIDTH="75" HEIGHT="24" ALIGN="BOTTOM" BORDER="0"><BR>
			<BR>
			<A HREF="index.htm"><IMG
			SRC="../buttonart/toc.gif" WIDTH="40" HEIGHT="40" ALIGN="BOTTOM" ALT="TOC" BORDER="0"
			NAME="toc4"></A><BR>
			<A HREF="ch07.htm"><IMG
			SRC="../buttonart/back1.gif" WIDTH="40" HEIGHT="40" ALIGN="BOTTOM" ALT="BACK" BORDER="0"
			NAME="toc1"></A><BR>
			<A HREF="ch09.htm"><IMG
			SRC="../buttonart/forward.gif" WIDTH="40" HEIGHT="40" ALIGN="BOTTOM" ALT="FORWARD"
			BORDER="0" NAME="toc2"></A><BR>
			<A HREF="index.htm"><IMG
			SRC="../buttonart/home.gif" WIDTH="40" HEIGHT="40" ALIGN="BOTTOM" ALT="HOME" BORDER="0"
			NAME="toc3"></A></TD>
		<TD WIDTH="520" VALIGN="TOP">
			<H2><FONT COLOR="#000077">Microsoft&#174; Access 97 Quick Reference</FONT></H2>
			<P>
			<H1 ALIGN="CENTER"><FONT COLOR="#000077">- 8 -<BR>
			Special Features and Programming</FONT></H1>
			<P>If you develop your <I>database</I> into an application for others to use, there
			are many features you can use to help users navigate through your database and to
			keep them where you want them to be. You can manage the toolbars and menus that come
			with Access as well as create your own.</P>
			<P>On forms and reports, each time a user performs an action, an <I>event</I> occurs.
			You can program responses to these events. The programming of Access is divided into
			two pieces: macros and <I>Visual Basic for Applications (VBA)</I>. The response to
			an event can be either a <I>macro</I> or VBA procedure (also called <I>code</I>).
			You can also create VBA code for general use throughout Access.</P>
			<P>When you have large databases and multiple users, you might also be concerned
			with optimizing your database as well as startup, multiuser, keyboard, and other
			options.
			<H2><FONT COLOR="#000077"><B>Events: Creating Event Response</B></FONT></H2>
			<P>Events are user actions such as clicking the mouse, pressing a <I>key</I>, or
			opening a <I>form</I>. Events can also be triggered by a Visual Basic statement or
			by the program itself. Events are associated with forms and reports, <I>sections</I>
			on forms and reports, and <I>controls</I> on forms. You can respond to an event by
			creating a <I>VBA</I> procedure or choosing a macro.
			<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
			<OL>
				<B>1.</B> Open the form or <I>report</I> in <I>Design View</I> and double-click the
				Form/Report Selector, a section, or a control (on a form) to open the properties
				sheet.
				<P><B>2.</B> Move to an Event <I>Property</I> (on the Event tab).</P>
				<P><B>3.</B> Type or choose the name of a macro from the drop-down list or click
				the build button (...) to bring up the Choose <I>Builder</I> <I>dialog box</I>.</P>
				<P><B>4.</B> Double-click Macro Builder to enter in macro statements or <I>Code</I>
				Builder to enter VBA statements.</P>
				<P><B>5.</B> When finished building the macro or code, click the Close (X) button.
				If you are building a macro, give the macro a name and choose OK.
			</OL>
			<P>For more help on building a macro, see also &quot;Macros: Create in Design Window.&quot;
			For more help on building code, see also &quot;Programming: Create a Procedure.&quot;
			<H2><FONT COLOR="#000077"><B>Hyperlink Appearance</B></FONT></H2>
			<P>The default appearance of <I>hyperlinks</I> is blue underlined text for links
			that have not been accessed. The default is purple for links that have been accessed
			(also called followed<I> </I>hyperlinks) since you opened the <I>database</I>. This
			is a general standard for Internet programs. However, you can change the appearance
			if you like.
			<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
			<OL>
				<B>1.</B> Choose <U>T</U>ools, <U>O</U>ptions and click the Hyperlinks/<I>HTML</I>
				tab.
				<P><B>2.</B> Choose a color from the H_yperlink Color and <U>F</U>ollowed Hyperlink
				Color drop-down lists and check whether you want to U<U>n</U>derline Hyperlinks.</P>
				<P><B>3.</B> If you want the hyperlink address shown in the status<I> </I>bar, check
				Sh<U>o</U>w Hyperlink Address in Status Bar. Choose OK when finished.
			</OL>
			<H2><FONT COLOR="#000077"><B>Locking Records</B></FONT></H2>
			<P>You have some options on what you want to happen when two people try to edit the
			same <I>record</I> at the same time. The Record Locks options deal with multiple
			users. You can set Record Locks globally for all databases, or for a specific <I>form</I>
			or <I>report</I>. There are three possible choices:
			<UL>
				<LI>Locks. There is no locking. The second user to save a record gets a prompt notifying
				that the record was changed by another user. The second user can choose which changes
				to keep.
				<P>
				<LI><I>All Records</I>. The <I>table</I> is not accessible for editing for anyone
				else (and any related tables that the form uses).
				<P>
				<LI><I>Edited Record</I>. Not available for reports; where the current record (and
				possibly some surrounding records) is not available for editing.
			</UL>
			<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
			<OL>
				<B>1.</B> To set <I>record locking</I> for all databases, choose <U>T</U>ools, <U>O</U>ptions;
				click the Advanced tab.
				<P><B>2.</B> Choose one of the following: <U>N</U>o Locks, A<U>l</U>l Records, E<U>d</U>ited
				Records; choose OK when finished.
			</OL>


			<BLOCKQUOTE>
			<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>To set record locking for a form,
			open the form in <I>Design View</I>, click the Properties button, and choose No Locks,
			All Records, or Edited Records from the Record Locks <I>property</I> (on the Data
			tab). On a report, choose No Locks or All Records on the Property Sheet Other tab.
			
<HR>


			</BLOCKQUOTE>

			<H2><FONT COLOR="#000077"><B>Macros: Create in Design Window</B></FONT></H2>
			<P>A <I>macro</I> is a series of stored actions that you can use for automating often-used
			procedures. You can attach macros to <I>command buttons</I>, menu choices, or other
			events for a form or report. When you use the Menu <I>Builder</I> in versions prior
			to Access 97, you automatically create a series of macros. (See also &quot;Menu:
			Create Custom.&quot;)</P>
			<P>For most macros, you can also create a <I>VBA</I> procedure. VBA procedures give
			you more control than macros, especially the ability to control errors. (See also
			&quot;Programming: Create a Procedure.&quot;)
			<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
			<OL>
				<B>1.</B> Click the Macros tab in the <I>Database window</I> and choose the <U>N</U>ew
				command button. The Macro Design Window opens.
				<P><B>2.</B> In the Action column, type or choose an action from the drop-down list.</P>
				<P><B>3.</B> If desired, type a comment on the same row in the Comment column.</P>
				<P><B>4.</B> In the lower half of the screen, type or choose any Action <I>Arguments</I>
				for the specific action you chose in Step 2. For some arguments, you have the choice
				of a Build button to help you create the argument.</P>
				<P><B>5.</B> Repeat steps 2-4 for each action you want in the macro. Click the Save
				button to save the macro and give it a name, then choose OK.
			</OL>
			<P>To attach a macro to an <I>event</I>, type the macro name in the Event <I>property.</I>
			(See also &quot;Events: Creating Event Response.&quot;)


			<BLOCKQUOTE>
			<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT> There is a special macro that will run
			when you open your database. Name your macro AutoExec. If you don't want this macro
			to run when you open the database, hold down the Shift key as you open the file.
			
<HR>


			</BLOCKQUOTE>

			<H2><FONT COLOR="#000077"><B>Macros: Create with Database Window</B></FONT></H2>
			<P>You can also create macros by using drag-and-drop from the Database window. This
			is especially useful if you want to open multiple forms or print multiple reports.
			After you drag-and-drop objects into the <I>Macro</I> Design window, you can modify
			the macro actions to suit your needs. Before you begin, first close all windows except
			the Database window.
			<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
			<OL>
				<B>1.</B> Click the Macros tab in the Database window and choose the <U>N</U>ew <I>command
				button</I>. The Macro Design window opens.
				<P><B>2.</B> Choose <U>W</U>indow, <U>T</U>ile Vertically to move the Database window
				and Macro Design window side-by-side.</P>
				<P><B>3.</B> Click the <I>object</I> tab button (such as Reports) and drag the object
				names into each line of the Macro Design window.</P>
				<P><B>4.</B> If desired, change the <I>arguments</I> for each object.</P>
				<P><B>5.</B> Click the Save button to save the macro and give it a name and choose
				OK.
			</OL>
			<P>After you create a macro, you can attach it to a button or menu item. (See also
			&quot;<I>Controls</I>: Command Button Create&quot; in the Forms and <I>Reports</I>
			part of this book.)


			<BLOCKQUOTE>
			<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT> The defaults for each object you drop in
			the Macro Design window are as follows:
			<UL>
				<LI><I>Table</I> and <I>query</I> in <I>Datasheet View</I> and Edit mode
				<P>
				<LI><I>Form</I> in <I>Form View</I> and Normal mode
				<P>
				<LI>Report in Print View (prints reports)
				<P>
				<LI>A macro will run, and a <I>module</I> will open for editing.
			</UL>
			<P>
<HR>


			</BLOCKQUOTE>

			<H2><FONT COLOR="#000077"><B>Macros: Groups</B></FONT></H2>
			<P>If you use a separate <I>macro</I> name for every macro you create, your macro
			list can become long and unwieldy. You might have problems finding and managing your
			macros. An alternative is to keep related macros together by creating macro groups
			and name the macros within each <I>group</I>. First, create the actions for a macro.
			(See &quot;Macros: Create with Database Window.&quot;)
			<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
			<OL>
				<B>1.</B> Select a macro in the Database window and choose <U>D</U>esign.
				<P><B>2.</B> If the Macro Name column is not visible, click the Macro Names button
				on the toolbar.</P>
				<P><B>3.</B> Type the name of the macro in the Macro Name column in the first row
				of the macro.</P>
				<P><B>4.</B> Click the Save button to save the macro group and give it a name (if
				you haven't already), and choose OK.
			</OL>
			<P>To choose the macro within a group in an <I>event</I> procedure (or the RunMacro
			action within another macro), choose or type the macro group name, a period, and
			then the macro name.


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


			</BLOCKQUOTE>

			<H2><FONT COLOR="#000077"><B>Macros: Keyboard Shortcuts</B></FONT></H2>
			<P>If you want to create your own keyboard shortcuts that will operate throughout
			your <I>database</I>, you can use the <I>Macro</I> Name column and type characters
			representing keyboard combinations. Be careful, however, not to include keyboard
			combinations you often use such as Ctrl+C for Copy or Alt plus any of the underlined
			letters of each of the menus. First, complete the procedures in the previous &quot;Macros:
			Groups&quot; section before proceeding with this task.


⌨️ 快捷键说明

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