📄 vcg18.htm
字号:
Occurs when Access returns to a previous report section during report formatting.
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
No equivalent.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
OnTimer
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Forms
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
When the interval specified by the form's TimerInterval property elapses.
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Create a timer with the desired interval.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
OnUnload
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Forms
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
When a form is closed but not yet removed.
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Handle the WM_CLOSE message.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
OnUpdated
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Controls
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
When an OLE object's data has been modified.
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
No direct equivalent.</FONT>
</TABLE></CENTER><BR>
<A NAME="E69E232"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Actions That Manipulate Forms, Reports, and Controls</B></FONT></CENTER></H4>
<BR>
<P>Many of the Access macro actions that manipulate forms and controls have corresponding Visual C++ functionality. Creating reports using the ReportEase, ReportSmith, or Crystal Reports products in Visual C++ applications differs greatly from using Access's integrated report generator, as discussed in Chapter 12, "Printing Reports with Report Generators." Thus, Access macro actions that pertain to reports don't have Visual C++ counterparts. See Table 18.2 for a few examples of macro actions and possible Visual C++ workarounds.
<BR>
<BR>
<P ALIGN=CENTER>
<CENTER>
<FONT COLOR="#000080"><B>Table 18.2. Visual C++ counterparts of Access form and control actions.</B></FONT></CENTER>
<BR>
<CENTER><TABLE BORDERCOLOR=#000040 BORDER=1 CELLSPACING=2 CELLPADDING=3 >
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
<I>Access Action</I>
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
<I>Purpose</I>
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
<I>Visual C++ Substitute</I>
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Close (form or report)
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Closes a form or report object.
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Use CWnd::OnClose().
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
GoToControl
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Sets the focus to a control on a form.
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Use CWnd::SetFocus().
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Maximize, Minimize, Restore
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Sets the window style of a form.
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Use SetWindowPlacement().
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
MoveSize
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Determines the size and position of a form.
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Use either SetWindowPos() or SetWindowPlacement().
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
OpenForm
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Opens and displays
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Use CDialog::DoModal().
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
a form.
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080><BR></FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
OpenReport
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Opens a report for print preview or printing.
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
No equivalent.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Print
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Prints the active object (forms only).
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
No equivalent.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
RepaintObject
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Redraws the selected object.
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Use CWnd::Invalidate().
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Requery
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Updates a specified control.
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Use CDatabase::Close(), and then modify m_strFilter to reflect the new WHERE parameters. Then reopen the datasource with CDatabase::Open().
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
SetValue
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Sets the value of a property (macros only).
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
No equivalent.</FONT>
</TABLE></CENTER><P>Generally it's not difficult to add reporting on Access databases using Crystal Reports, because it's included with Visual C++ 4. If you need to distribute the Crystal Reports report designer, it's possible to license the report designer for redistribution.
<BR>
<P>You can create reports using the more traditional method of simply writing the code. However, using a report generator package will provide a much more professional product with much less effort. Visual C++ and MFC don't have any built-in report generation facilities. You will have to create your own reporting system if you don't use a report generator such as Crystal Reports. Generally, most programmers find that it isn't cost effective to design and code the report generation portions of their applications.
<BR>
<BR>
<A NAME="E69E233"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Actions That Manipulate Database Objects</B></FONT></CENTER></H4>
<BR>
<P>The Access macro actions listed in Table 18.3 manipulate Access's equivalent of a Visual C++ data-access object. It's important to bear in mind the distinctions between the Access Table and QueryDef objects that underlie Access forms and reports and the same database objects opened in Visual C++. Using Access, you can manipulate only the record pointer of a Table or QueryDef object to which an Access form or report is bound with Access macro actions. Visual C++ lets you manipulate the record pointer of a data control directly with the Move...() functions. The only Access macro action you can't imitate directly in Visual C++ is an OpenQuery action that specifies a search parameter. Visual C++ CDatabase objects must be closed and then reopened with a new m_strFilter string.
<BR>
<BR>
<P ALIGN=CENTER>
<CENTER>
<FONT COLOR="#000080"><B>Table 18.3. Visual C++ counterparts of Access database object manipulation actions.</B></FONT></CENTER>
<BR>
<CENTER><TABLE BORDERCOLOR=#000040 BORDER=1 CELLSPACING=2 CELLPADDING=3 >
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
<I>Access Action</I>
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
<I>Purpose</I>
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
<I>Visual C++ </I><I>CRecordSet </I><I>Substitute</I>
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Close (Table or QueryDef object)
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Closes a database object.
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Use CRecordSet::Close().
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
FindNext
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Finds the next record that meets specified criteria.
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Use CRecordSet::MoveNext().
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
FindRecord
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Finds the first record that meets specified criteria.
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Use CRecordSet::MoveFirst().
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
GoToRecord
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Goes to the record specified by an argument value (previous, next, first, last, record number, new record).
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Use CRecordSet::Move().
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
OpenQuery
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Opens a QueryDef object in datasheet, design, or print preview views, or executes an action query.
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Close the current query using CRecordSet::Close(), modify the m_strFilter to specify the WHERE clause, and then use CRecordSet::Open() to reopen the recordset with the new query value.
</FONT>
<TR>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
OpenTable
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Opens a specified Table object in datasheet, design, or print preview views.
</FONT>
<TD VALIGN=top BGCOLOR=#80FFFF ><FONT COLOR=#000080>
Use CRecordSet::Open().</FONT>
</TABLE></CENTER><BR>
<A NAME="E69E234"></A>
<H4 ALIGN=CENTER>
<CENTER>
<FONT SIZE=4 COLOR="#FF0000"><B>Actions That Translate Directly to Visual C++ or Windows Functions</B></FONT></CENTER></H4>
<BR>
<P>Many of Access's general-purpose macro actions have exact counterparts in Visual C++ and Windows. Table 18.4 lists Access macro actions that are duplicated in Visual C++ and Windows.
<BR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -