Getting the last auto number of a record added in MS Access
am 11.07.2005 17:55:02 von fahadomanI have a form where I would like to Getting the last auto of a record added
in MS Access in Windows 2000 Server using DNS connect method for connecting
to the Database
I had tried to use
objRS.Fields.Item("company_id").Value
objRS("company_id")
CStr(objRS("company_id"))
It really made me crazy because it gives me an empty auto number. What is
the problem?
HELP ME PLZZZZ
Below you will find the whole code
<%
Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.mode=3
conn.Open "DSN=formsdb"
DIM objRS, UrlStr, objRSregisteration
Set objRS = Server.CreateObject("ADODB.Recordset")
Set objRStestadding = Server.CreateObject("ADODB.Recordset")
objRS.CursorType = 2
objRS.LockType = 3
objRS.Open "company", conn,,,adcmdtable
objRS.AddNew
objRS("language_interface") = fixQuotes(request.form("language_interface"))
objRS("name_of_applicant") = fixQuotes(request.form("name_of_applicant"))
objRS("office_number") = fixQuotes(request.form("office_number"))
objRS("e_mail") = fixQuotes(request.form("e_mail"))
objRS("user_name") = fixQuotes(request.form("e_mail"))
objRS("identification_type") = fixQuotes(request.form("identification_type"))
objRS("identification_number") =
fixQuotes(request.form("identification_number"))
objRS("town_postel_office") = fixQuotes(request.form("town_postel_office"))
objRS("building_no") = fixQuotes(request.form("building_no"))
objRS("floor_no") = fixQuotes(request.form("floor_no"))
objRS("postel_code") = fixQuotes(request.form("postel_code"))
objRS("street_name") = fixQuotes(request.form("street_name"))
objRS("contact_person") = fixQuotes(request.form("contact_person"))
objRS("contact_tel") = fixQuotes(request.form("contact_tel"))
objRS("contact_e_mail") = fixQuotes(request.form("contact_e_mail"))
objRS("contact_job") = fixQuotes(request.form("contact_job"))
objRS("p_o_box") = fixQuotes(request.form("p_o_box"))
objRS("fax_number") = fixQuotes(request.form("fax_number"))
objRS("website") = fixQuotes(request.form("website"))
objRS("catgory_business") = fixQuotes(request.form("catgory_business"))
objRS("application_date") = date()
objRS("reg_status") = "waiting"
objRS("num_emp_applying") = request.form("num_emp_applying")
objRS("sector") = request.form("sector")
objRS.Update
dim contact_person, intID, e_mail
intID = objRS.Fields.Item("company_id").Value
e_mail = objRS.Fields.Item("e_mail").Value
response.write("
here please ->" & CStr(objRS("company_id")) & "
test" & CStr(intID) & "here please" & CStr(objRS.Fields.Item(1).Value))
response.write("
" & e_mail)