?? 為查詢添加選擇準(zhǔn)則.htm
字號:
<html>
<head>
<!-- #BeginEditable "doctitle" -->
<title>洪恩在線 - Access 2000</title>
<!-- #EndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="/pub/css/home.css">
<link rel="stylesheet" href="/pc/pc.css">
<meta name="keywords" content="電腦,教育,教程,辦公軟件,microsoft,Office,office,Access,Access 2000,數(shù)據(jù)庫,查詢,表">
<link rel="stylesheet" href="oa.css">
</head>
<body bgcolor="white" text="black" topmargin="10" leftmargin="0" marginwidth="0" marginheight="10">
<!--頂部開始-->
<script language="Javascript" src="/pub/js/head.js"></script>
<!--頂部結(jié)束-->
<table width="760" height="20" border=0 cellspacing="0" cellpadding="0" align="center">
<tr>
<td height=20 class="p1" bgcolor="#E8E8E8" align="left"><font color="#000000"><font color="#FF9966">當(dāng)前位置</font>:<a href="/default.htm">在線教程</a> -> Access 2000</font></td>
</tr>
</table>
<table width="760" border=0 cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="15"></td>
</tr>
</table>
<table width="760" cellspacing="0" border=0 cellpadding="0" align="center">
<tr>
<td width="145" valign="top" bgcolor="#E8E8E8" align="left" style="color:blue" height="183">
<img src="/pc/img/blank.gif" width="1" height="10" align=center><br>
<table width="145" border="0" cellspacing="0" cellpadding="0" bordercolor="#F8AC0E" align="center" height="20">
<tr bgcolor="000099" valign="middle">
<td width="109" align="center" class="p2"><font color="#FFFFFF"><b>Access
2000</b></font><font color="#FF3333" ><b></b></font></td>
<td height="20" bgcolor="#E8E8E8" width="13"> </td>
<td height="20" bgcolor="#E8E8E8" width="23"> </td>
</tr>
</table>
<p><span class="p1"><font color="#0000CC"><img src="img/small.gif" width="12" height="12">
<a href="ac2k0101.htm">初識Access 2000<br>
</a></font><font color="#0000CC"> </font></span><span class="p1"><font color="#0000CC"><img src="img/small.gif" width="12" height="12">
<a href="ac2k0201.htm">窗口接口使用簡介<br>
</a></font></span><font color="#0000CC"><span class="p1"><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font>
<a href="ac2k0301.htm">用向?qū)Ы?shù)據(jù)庫</a></span></font><font color="#0000CC"><span class="p1"><a href="ac2k0301.htm">
<br>
</a><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font>
<a href="ac2k0401.htm">數(shù)據(jù)庫的結(jié)構(gòu)</a> <span class="p1"><a href="ac2k0403.htm">
</a></span> <br>
<font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font>
<a href="ac2k0501.htm">用表向?qū)Ы⒈?lt;/a></span></font> <font color="#0000CC"><span class="p1"><a href="ac2k0501.htm">
<br>
</a><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font>
<a href="ac2k0601.htm">在表中輸入數(shù)據(jù)</a> <a href="ac2k0601.htm"><br>
</a><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font>
<a href="ac2k0701.htm">數(shù)據(jù)的類型和屬性</a><span class="p1"> </span><br>
</span></font><span class="p1"><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font>
<a href="ac2k0801.htm">定義表之間的關(guān)系</a></span><span class="p1"><br>
<font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font>
<a href="ac2k0901.htm">建立簡單的查詢</a></span><span class="p1"> <br>
<font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font>
為查詢制定規(guī)則</span></p>
<p style="line-height:17pt" align="left"><span class="p1"> 為查詢添加選擇準(zhǔn)則<br>
<a href="ac2k1002.htm">使用表達(dá)式生成器</a><br>
<a href="ac2k1003.htm">表達(dá)式的幾種常用符號</a><br>
<a href="ac2k1004.htm">補充內(nèi)容一</a><br>
<a href="ac2k1005.htm">補充內(nèi)容二</a><br>
<a href="ac2k1006.htm">補充內(nèi)容三</a><br>
<a href="ac2k1007.htm">補充內(nèi)容四</a><br>
<a href="ac2k1008.htm">補充內(nèi)容五</a><br>
<a href="ac2k1009.htm">補充內(nèi)容六</a><br>
<a href="ac2k1010.htm">補充內(nèi)容七</a><br>
<a href="ac2k1011.htm">補充內(nèi)容八</a><br>
<a href="ac2k1012.htm">補充內(nèi)容九</a><br>
<a href="ac2k1013.htm">補充內(nèi)容十</a><br>
<a href="ac2k1014.htm">補充內(nèi)容十一</a><br>
<a href="ac2k1015.htm">補充內(nèi)容十二</a><br>
</span><span class="p1"> <br>
<font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font>
<a href="ac2k1101.htm">如何建立數(shù)據(jù)窗體<br>
</a><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font>
<a href="ac2k1201.htm">生成數(shù)據(jù)打印報表</a><br>
<font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font>
<a href="ac2k1301.htm">為WEB頁提供數(shù)據(jù)<br>
</a><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font>
<a href="ac2k1301.htm"></a></span><a href="ac2k1401.htm" class="p1">用圖表顯示數(shù)據(jù)</a><br>
<span class="p1"><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font>
<a href="ac2k1301.htm"></a></span><a href="ac2k1501.htm"><span class="p1">宏的使用</span><br>
</a><span class="p1"><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font>
<a href="ac2k1301.htm"></a></span><a href="ac2k1601.htm"><span class="p1">模塊與“VBA”語言</span><br>
</a><span class="p1"><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font>
<a href="ac2k1301.htm"></a></span><a href="ac2k1701.htm"><span class="p1">SQL語言妙用</span><br>
</a><span class="p1"><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font>
<a href="ac2k1301.htm"></a></span><a href="ac2k1801.htm"><span class="p1">外部數(shù)據(jù)的使用</span><br>
</a><span class="p1"><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font>
<a href="ac2k1301.htm"></a></span><a href="ac2k1901.htm"><span class="p1">數(shù)據(jù)的優(yōu)化和安全</span><br>
</a><span class="p1"><font color="#0000CC"><img src="img/small.gif" width="12" height="12"></font>
<a href="ac2k1301.htm"></a></span><a href="ac2k2001.htm"><span class="p1">容易忽略的工作</span></a></p>
<p style="line-height:17pt" align="center" class=p1><a href=/pc/bin/msg.pl?file_id=k_ac2k_10 target="_blank"><br>
</a>
<script language="javascript">
speak_num="za"
</script>
<script language="javascript" src=/pc/var/pc_k_ac2k_10.js>
</script>
<script language="javascript">
var num=0
if (!isNaN(speak_num)){
num=speak_num;
}
else{
num=0
}
document.writeln ("已有")
document.writeln (num)
document.writeln ("條發(fā)言")
</script>
</p>
</td>
<td width=1 bgcolor=#0586D7 height="183"><img src="/pc/img/blank.gif" width="1" height="1">
</td>
<td valign="top" bgcolor="#FFFFFF" background="/pc/img/line.gif" width="614" height="183">
<table width="95%" border="0" align="center">
<tr background="/pc/img/line.gif">
<td colspan="2" class="p3" height="50">
<div align="center"><font color="#003333"><b><font color="#ff3333">為查詢添加選擇準(zhǔn)則</font></b></font></div>
</td>
</tr>
<tr background="/pc/img/line.gif">
<td colspan="2" class="p2">
<p class=p2><span style="line-height:17pt"> 這個查詢已經(jīng)建立起來了,但如果只想看看北京地區(qū)的客戶訂單情況,應(yīng)當(dāng)該怎么辦嗎?其實只需要在這個查詢中再添加一個字段,然后再為這個字段添加一條準(zhǔn)則就可以解決這個問題,這個查詢的數(shù)據(jù)表中就只有北京地區(qū)的客戶訂單情況了。</span></p>
<p class=p2><span style="line-height:17pt"> 添加的字段和準(zhǔn)則到底是怎么回事呢?其實在這個查詢中添加的字段是“客戶信息表”中的“城市”字段,因為這個表和“訂單信息表”有關(guān)系。所以當(dāng)我們在查詢中添加“城市”字段后,這個字段就會自動將簽單公司所在城市的名稱信息反映出來。有了這個前提我們只要再添加一個限制條件,也就是讓“城市”字段中的值等于“北京”。這時再看查詢的數(shù)據(jù)表視圖就會發(fā)現(xiàn),只有滿足了這些條件的記錄才會顯示出來。</span></p>
<p class=p2><span style="line-height:17pt"> 往查詢里添加選擇準(zhǔn)則,有兩個問題應(yīng)該考慮,</span></p>
<p class=p2><span style="line-height:17pt"> 首先是為哪個字段添加“準(zhǔn)則”,其次就是要在這個字段添加什么樣的“準(zhǔn)則”。
就拿剛才的這個例子來說吧,很明顯就是為“城市”字段添加“準(zhǔn)則”,而添加的準(zhǔn)則就是限制“城市”字段中的值只能等于“北京”。限定了這兩個條件,就可以很容易地實現(xiàn)任何一種選擇準(zhǔn)則了。</span></p>
<p class=p2><span style="line-height:17pt"> 如何在查詢中添加準(zhǔn)則呢?我們就將剛才的例子做一遍吧。首先我們要通過“顯示表”對話框添加“客戶信息表”到查詢窗口中,然后選取這個表中的“城市”字段作為查詢中的一個字段,由于我們不想讓這個字段中的值顯示在數(shù)據(jù)表中,就取消此字段的可見性,將它的“顯示”屬性定為“否”。添加完這個字段就可以添加條件規(guī)則了,現(xiàn)在我們就可以在“城市”字段的“規(guī)則”屬性中寫上“="北京"”,這樣就可以了,如下圖所示。</span></p>
<p class=p2 align="center"><img src="img/ac2k1001.gif" width="520" height="282" alt="添加準(zhǔn)則" border="1"></p>
<p class=p2><span style="line-height:17pt"> 但有時候,當(dāng)我們需要對查詢記錄中的幾種信息同時進(jìn)行限制的時候,就需要將所有這些限制規(guī)則一一添加到需要的字段上,這樣只有完全滿足限制條件的那些記錄才能顯示出來。現(xiàn)在我就在“訂貨數(shù)量”和“總金額”上都添加一個規(guī)則,讓“訂貨數(shù)量”大于“200”,“總金額”小于“100000”,這個查詢的數(shù)據(jù)表,只有同時滿足這三個條件限制的記錄才被選了出來,如下圖所示。
</span></p>
<p class=p2 align="center"><img src="img/ac2k1002.gif" width="520" height="131" border="1" alt="添加多個田間限制"></p>
<p class=p2><span style="line-height:17pt"> 除此之外,一個字段還可以有多條限制“規(guī)則”。每條“規(guī)則”之間可以用邏輯符號來連接。比如要為“總金額”字段添加“<100000”或者“>150000”的規(guī)則,只要在“規(guī)則”欄內(nèi)輸入“<100000
or >150000”就可以了。</span></p>
<p class=p2 align="center"> </p>
</td>
</tr>
</table>
<p align="center"><a href="ac2k0909.htm">上一頁</a> <a href="ac2k1002.htm">下一頁</a></p>
<p align="center"> </p>
<p align="center" class=p2><a href=/pc/bin/msg.pl?file_id=k_ac2k_10 target="_blank"><br>
</a></p>
</td>
</tr>
</table>
<script language="Javascript" src="/pub/js/foot.js"></script>
<!--底部結(jié)束-->
</body>
</html>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -