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

📄 ch06.htm

📁 Microsoft_Access_97_Quick_Reference.zip
💻 HTM
📖 第 1 页 / 共 5 页
字号:
			are registered automatically when you install them, others need to be registered.
			The Calendar control comes with Microsoft Access. If you don't have it installed,
			this option is a choice under the Microsoft Access options during the setup procedure.
			If your control is not registered, or if you want to unregister the control, use
			the following procedure.
			<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
			<OL>
				<B>1.</B> Choose <U>T</U>ools, <I>ActiveX </I><CITE>C</CITE><I>ontrols</I>
				<P><B>2.</B> To unregister a control, move to the name in the Available Controls
				list and choose the <U>U</U>nregister button.</P>
				<P><B>3.</B> To add a control, click the Register button and search for the file
				(extension is OCX) and choose the Open <I>command button</I>.
			</OL>
			<H2><FONT COLOR="#000077"><B>Controls: Add</B></FONT></H2>
			<P>A <I>control</I> is any <I>object</I> such as a <I>text box</I>, line, <I>subform</I>,
			or <I>label</I> added to a <I>form</I> or <I>report</I>. You can add controls in
			many different ways. This section summarizes how to add controls. On reports, the
			controls you normally add include text boxes, labels, lines, rectangles, page-breaks,
			and perhaps check boxes. On forms you can use all the controls in the <I>Toolbox</I>.
			For more details, see the following tasks for descriptions on how to add specific
			controls.
			<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
			<OL>
				<B>1.</B> To add text boxes, <I>check boxes</I>, or <I>Bound</I> Object Frames that
				are appropriate to the <I>field</I> type, use a wizard to build the form or click
				the Field List button in Form <I>Design View</I> and drag the field name onto a form
				from the Field <I>List box</I>.
				<P><B>2.</B> To add <I>combo boxes</I>, <I>option groups</I>, list boxes, command<I>
				</I>buttons, subforms, or <I>subreports</I>, click the Control Wizards button on
				the Toolbox in Form Design View, click the specific button in the Toolbox, click
				the form where you want to place the control, and follow the <I>dialog boxes</I>
				of the wizard.</P>
				<P><B>3.</B> To add a <I>toggle button</I>, <I>option button</I>, or check box outside
				of an option <I>group</I>, select that button on the Toolbox first, and drag the
				field name from the Field List box to the form.</P>
				<P><B>4.</B> To draw a line, rectangle, or tab control, click that button in the
				Toolbox and then drag the mouse pointer in the form or report.</P>
				<P><B>5.</B> To add a label, click the Label button in the Toolbox, click in the
				form or report, and then type the text for the label.
			</OL>


			<BLOCKQUOTE>
			<P>
<HR>
<FONT COLOR="#000077"><B>TIP:</B></FONT><B> </B>To lock a control in the Toolbox
			so that you can create several of those controls, double-click the control tool before
			you create the control on the design surface. That tool stays selected until you
			select another. 
<HR>


			</BLOCKQUOTE>

			<H2><FONT COLOR="#000077"><B>Controls: Align</B></FONT></H2>
			<P>When you move <I>controls</I> (see &quot;Controls: Move) it is sometimes difficult
			to get the controls to line up. In these cases, align the controls with menu options.
			<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
			<OL>
				<B>1.</B> In the <I>Design View</I> of a <I>form</I> or <I>report,</I> select two
				or more controls (drag a selection box or hold down Shift and click each control).
				<P><B>2.</B> Choose F<U>o</U>rmat, <U>A</U>lign.</P>
				<P><B>3.</B> Choose one of the menu items: <U>L</U>eft, <U>R</U>ight, <U>T</U>op,
				or <U>B</U>ottom.
			</OL>
			<P>The To <CITE>G</CITE><I>rid</I> item on the Align menu aligns the controls to
			the nearest grid dot. To have controls line up to the grid as you place them on the
			form or report, choose F<U>o</U>rmat, S<U>n</U>ap to Grid. (See also &quot;Controls:
			Add.&quot;) To see the grid, choose <U>V</U>iew, <U>G</U>rid.


			<BLOCKQUOTE>
			<P>
<HR>
<FONT COLOR="#000077"><B>TIP:</B></FONT> If you often align controls, you can create
			your own toolbar or add the align tools to the <I>Toolbox</I> or other toolbar. Right-click
			the Toolbox and choose <U>C</U>ustomize. Click the <U>C</U>ommands tab of the Customize
			<I>dialog box</I> and choose Form/Report Design in the Cate-gories list. Scroll down
			the Comman<U>d</U>s list and drag the Align Left, Align Right, Align Top, and Align
			Bottom to your toolbar. 
<HR>


			</BLOCKQUOTE>

			<H2><FONT COLOR="#000077"><B>Controls: Bound Control Create</B></FONT></H2>
			<P><I>Controls</I> are devices that display data. When a control displays data from
			a <I>data source</I>, it is called a <I>bound</I> control.
			<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
			<OL>
				<B>1.</B> Open a <I>form</I> or a <I>report</I> in <I>Design View</I>.
				<P><B>2.</B> Click the <I>Field</I> List button on the toolbar to display the Field
				List.</P>
				<P><B>3.</B> Select the field(s) that your control is bound to.</P>
				<P><B>4.</B> Drag the selected field(s) to the form or report and position the upper-left
				corner of the icon where the upper-left corner of the control (not its associated
				<I>label</I>) will be positioned, then release the mouse button.
			</OL>
			<P>Access creates the appropriate control for that field and sets <I>properties</I>
			of the control based on the underlying field properties from the <I>table</I> and
			default display control properties.</P>
			<P>If the bound control isn't the one you want, click the control and press Delete.
			<H2><FONT COLOR="#000077"><B>Controls: Calculation Create</B></FONT></H2>
			<P>You can create controls on your forms and reports that perform calculations. After
			you create a control, you type in the <I>expression</I> for the calculation. (See
			&quot;Calculated Fields: Forms and Reports--Create by Typing&quot; and other tasks
			in the Calculations part for details on the types of calculations you can create.)
			<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
			<OL>
				<B>1.</B> In Design View of a form or report, click the <I>Text Box</I> button in
				the <I>Toolbox</I> and click where you want the calculation to appear.
				<P><B>2.</B> Type equals (<B>=</B>) and then type the expression to calculate. Include
				<I>field</I> names in square brackets. For example, =<B>[Unit Price]*[Amount]</B>
				for an extended price. If the control is in a header or footer section of a report,
				use summary functions such as <TT>Sum</TT>() or <TT>Avg</TT>() and include the field
				names in brackets within the paren-theses.</P>
				<P><B>3.</B> To edit the formula, right-click the control, choose <U>P</U>roperties.
				In the Control Source <I>property</I>, change the expression. If the formula is too
				large to see, press Shift+F2 to zoom on the Control Source property.
			</OL>
			<H2><FONT COLOR="#000077"><B>Controls: Change Control Type</B></FONT></H2>
			<P>Access offers you an easy way to change an existing control on a <I>form</I> or
			a <I>report</I>. The C<U>h</U>ange To command can convert one control to another
			control. When doing so, the appropriate property settings are preserved. When a property
			exists, it is copied; when a property doesn't exist, it is ignored. If a property
			is left blank in the original control, Access sets it using the default control style.</P>
			<P>The C<U>h</U>ange To command is used most often to change one type of control
			to another of the same type (for example, a <I>bound</I> control to another type
			of bound control). Only appropriate choices are available in the C<U>h</U>ange To
			submenu when you select a particular type of control.
			<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
			<OL>
				<B>1.</B> Open the form or report in <I>Design View</I>.
				<P><B>2.</B> Select the control you want to change.</P>
				<P><B>3.</B> Select new control type from the available choices on the F<U>o</U>rmat,
				C<U>h</U>ange To submenu.
			</OL>
			<H2><FONT COLOR="#000077"><B>Controls: Check Box Create</B></FONT></H2>
			<P>A check box allows for speedy input of yes/no type fields. A check mark in the
			box indicates yes; a blank indicates no. When you're inputting, you can also move
			to the <I>field</I> with the keyboard and press Spacebar to turn the box on or off.
			<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
			<OL>
				<B>1.</B> Open a <I>form</I> in <I>Design View</I>.
				<P><B>2.</B> Display the Field List by clicking the Field List button on the toolbar.</P>
				<P><B>3.</B> Drag a field with a yes/no <I>data type</I> to the form. The default
				control for the field is a check box.
			</OL>
			<H2><FONT COLOR="#000077"><B>Controls: Colors</B></FONT></H2>
			<P>When you're designing an input form, consider using colors. The effective use
			of color can make inputting less boring and draw attention to important parts of
			the form. If you have a color printer, you can also print the form in color.
			<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
			<OL>
				<B>1.</B> Open the form or <I>report</I> in Design View and select the <I>control</I>
				or the background of the detail or a header or footer section.
				<P><B>2.</B> For text controls, click the Font/Fore Color button to change the text
				to the color on the button, or use the button's drop-down arrow to choose another
				color.</P>
				<P><B>3.</B> For text controls, rectangles, and the background of each section, click
				the Fill/Back Color button to change the background to the color on the button, or
				use the button's drop-down arrow to choose another color.</P>
				<P><B>4.</B> For lines, text controls, and rectangles, click the Line/Border Color
				button to change the line or the outline of the control to the color on the button,
				or use the button's drop-down arrow to choose another color.
			</OL>
			<P>If you want to see a grayed button when the value is <I>Null</I>, change the Triple
			State <I>property</I> to Yes. (See &quot;Data: Blanks, Nulls, and Zero-Length Strings&quot;
			in the Table and Database Design part of this book.)


			<BLOCKQUOTE>
			<P>
<HR>
<FONT COLOR="#000077"><B>NOTE:</B></FONT><B> </B>To change the formatting of the
			control programmatically, look at the format properties on the Property sheet. The
			code for the property name (<TT>BackColor</TT>) is without a space. To change the
			back color to red, the code would be <TT>controlname.BackColor = 255.</TT> To find
			the values for the colors, first change the color using the build button... for that
			property on the Property sheet. Then copy the number and paste it into your code.
			
<HR>


			</BLOCKQUOTE>

			<H2><FONT COLOR="#000077"><B>Controls: Combo Box Create</B></FONT></H2>
			<P>A <I>combo box</I> enables the user to type or choose from a list of predetermined
			options. A combo box is especially useful if you have a code you need to place in
			a <I>form</I> and the code corresponds to a value. Instead of having to remember
			the codes, a user can select from more meaningful data. Using a combo box can also
			help avoid data entry errors.</P>
			<P>The source for the drop-down list in a combo box can be a <I>table</I> or <I>query</I>,
			values you type during design, or a list of <I>field</I> names from a table or query.
			If you drag a field from the Field List whose <I>data type</I> is already a Lookup
			Field, Access will automatically create a combo box for you from the properties of
			the field in Table Design (see &quot;Lookup Column: Create with Wizard&quot; in the
			Table and Database Design part of this book). As an alternative to a combo box, you
			can also use a <I>list box.</I> (See &quot;<I>Controls</I>: List Box Create.&quot;)
			<H3><FONT COLOR="#000077"><B>Steps</B></FONT></H3>
			<OL>
				<B>1.</B> From the <I>Design View</I> of a form, click the <I>Toolbox</I> if necessary
				and make sure the <I>Control</I> Wizards button is selected.
				<P><B>2.</B> Click the Combo Box button on the toolbar and click in the form where
				you want the combo box to appear. The Combo Box Wizard opens.</P>
				<P><B>3.</B> To type your own values of what will appear in the combo box, choose
				I Will Type the Values I Want, choose <U>N</U>ext, and type the number of columns
				and values in each column you want. If you type more than one column, choose which
				column will be the source for the data to store in the field underlying the combo
				box, which field you want to store the value in, and the <I>label</I> for the combo
				box on the next screens.</P>
				<P><B>4.</B> To use an existing table or query, on the first screen of the Combo
				Box Wizard, choose the I Want the Combo Box option. Choose the table or query, the
				fields you want to see when you choose the drop-down arrow, the column width of the
				fields, and whether you want to hide the <I>key</I> column. As in Step 3, also choose
				which column becomes the value to store, which field you want to store the value
				in, and the label for the combo box on the next screens of the wizard.</P>
				<P><B>5.</B> If you want to use the combo box to move the form to a specific <I>record</I>,
				you usually place the box in the form header. On the first step of the Combo Box
				Wizard, choose the Find a Record (third choice), choose the fields you want, the
				column widths, and the label for your combo box on the next screens of the wizard.
			</OL>
			<P>After you finish the wizard, the combo box appears on your form. To see or modify
			the properties, right-click the combo box and choose <U>P</U>roperties. The important
			<I>properties</I> and the property tab they appear on are as follows:
			<UL>
				<LI><I>Control Source (Data tab).</I> This property is the field in your table where
				you're storing data.
				<P>
				<LI><I>Row Source (Data tab).</I> The name of the table or query used to lookup values.
				You can click the build button (...) to access the query <I>builder</I> and choose
				the fields and sort order of items that appear in the drop-down list. If you typed
				the list, the values appear separated by semi-colons with text enclosed in quotes.
				<P>
				<LI><I>Column Count (Format tab).</I> The number of columns from the row source used
				for the list.
				<P>
				<LI><I>Column Widths (Format tab).</I> The width displayed for each column in the
				list; 0 will not display a column.
				<P>
				<LI><I>Bound</I> <I>Column</I> <I>(Data tab)</I>. The column from the row source
				that will be placed in the field on the form.
				<P>
				<LI><I>List Width (Format tab).</I> The width of the entire drop-down list.<BR>
				<I>Limit to List.</I> This <I>property</I> determines whether you want to limit values
				to the table/query/list for your combo box or enable the user to type other values
				as well.
			</UL>


⌨️ 快捷键说明

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