我从登陆界面,登陆后转到一个表单界面, 我希望这个表单能自动生成单据号,在网上找了很多办法都无法成功...郁闷死了.我的access数据库表member 其中的一列为 f_djh  假设我最后一条记录是20101001,是否可以在用户登陆后显示的这个表单界面或者是刷新这个界面, 单据号就读取数据库最后一个然后+1 显示出来新单据号.下面是我这个表单界面的源码:**********<td width="100">&nbsp;</td>(希望能显示在红色这里)*********<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/bj.asp" -->
<%
' *** Edit Operations: declare variablesDim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmdDim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordIdDim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_iMM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If' boolean to abort record edit
MM_abortEdit = false' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variablesIf (CStr(Request("MM_insert")) = "form1") Then  MM_editConnection = MM_bj_STRING
  MM_editTable = "member"
  MM_editRedirectUrl = "sky.asp"
  MM_fieldsStr  = "hiddenField|value|zkl|value|c|value|a|value|b|value"
  MM_columnsStr = "f_rq|',none,NULL|f_zkl|none,none,NULL|f_xsje|none,none,NULL|f_zkje|none,none,NULL|f_jt|none,none,NULL"  ' create the MM_fields and MM_columns arrays
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")
  
  ' set the form values
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
  Next  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
  End IfEnd If
%>
<%
' *** Insert Record: construct a sql insert statement and execute itDim MM_tableValues
Dim MM_dbValuesIf (CStr(Request("MM_insert")) <> "") Then  ' create the sql insert statement
  MM_tableValues = ""
  MM_dbValues = ""
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_formVal = MM_fields(MM_i+1)
    MM_typeArray = Split(MM_columns(MM_i+1),",")
    MM_delim = MM_typeArray(0)
    If (MM_delim = "none") Then MM_delim = ""
    MM_altVal = MM_typeArray(1)
    If (MM_altVal = "none") Then MM_altVal = ""
    MM_emptyVal = MM_typeArray(2)
    If (MM_emptyVal = "none") Then MM_emptyVal = ""
    If (MM_formVal = "") Then
      MM_formVal = MM_emptyVal
    Else
      If (MM_altVal <> "") Then
        MM_formVal = MM_altVal
      ElseIf (MM_delim = "'") Then  ' escape quotes
        MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
      Else
        MM_formVal = MM_delim + MM_formVal + MM_delim
      End If
    End If
    If (MM_i <> LBound(MM_fields)) Then
      MM_tableValues = MM_tableValues & ","
      MM_dbValues = MM_dbValues & ","
    End If
    MM_tableValues = MM_tableValues & MM_columns(MM_i)
    MM_dbValues = MM_dbValues & MM_formVal
  Next
  MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"  If (Not MM_abortEdit) Then
    ' execute the insert
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End IfEnd If
%>
<%
Dim Recordset1
Dim Recordset1_numRowsSet Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_bj_STRING
Recordset1.Source = "SELECT * FROM member"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()Recordset1_numRows = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.STYLE1 {
font-size: 28px;
font-weight: bold;
color: #FF0000;
}
-->
</style>
</head><body>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="middle"><form id="form1" name="form1" method="POST" action="<%=MM_editAction%>">
      <table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td align="center"><p>&nbsp;</p>
            <p>&nbsp;</p>
            <p class="STYLE1">会员卡销售计提登记表</p>
            <hr />            <p>&nbsp;</p></td>
          </tr>
        <tr>
          <td><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td width="120"><div align="right">单据号:</div></td>
              <td width="100">&nbsp;</td>
              <td width="80">部门名称:</td>
              <td width="150"><%=session("MM_username")%></td>
              <td width="50">日期:</td>
              <td width="150">
  <%dim strdate
  strdate=year(now())&month(now())&day(now())
  response.write strdate
  %>
  <input name="hiddenField" type="hidden" value="<%=strdate%>" /></td>
            </tr>
          </table>
            <p>&nbsp;</p></td>
          </tr>
        <tr>
          <td><table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000">
            <tr>
              <td width="253"><div align="left"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;销售类型 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 折扣率</div></td>
              <td width="110"><div align="center">销售金额</div></td>
              <td width="110"><div align="center">折扣金额</div></td>
              <td width="110"><div align="center">计提金额</div></td>
            </tr>
            <tr>
              <td><select name="zkl" id="zkl" onchange="document.getElementById('txt').innerHTML = this.value"> 
  <option value="">请选择 </option>
  <option value="0.98">零售 金额3000元以下</option>
  <option value="0.97">团购 金额3千以上1万以下</option>
  <option value="0.96">团购 金额1万以上3万以下</option>
  <option value="0.95">团购 金额3万以上</option> 
                            </select>                 <span id="txt"> </span>&nbsp;</td>
              <td colspan="3"><p>
                <script>
function calc(i){ 
       document.getElementById('a').value = (i * 0.02).toFixed(2); 
       document.getElementById('b').value = (i * 0.008).toFixed(2); 
          } 
              </script>
<input name="c" type="text" id="c" onkeyup="calc(this.value)" size="10"/>

            <input name="a" type="text" id="a" size="10"/>
            元
            <input name="b" type="text" id="b" size="10"/>
            元</p>
                </td>
              </tr>
          </table></td>
          </tr>
        
        <tr>
          <td><p>&nbsp;</p>            <p align="center">&nbsp;</p>
            </td>
          </tr>
      </table>
        
      <input type="submit" name="Submit2" value="提交" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="reset" name="Submit" value="重填" />
<input type="hidden" name="MM_insert" value="form1">
</form>
    </td>
  </tr>
</table>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>