Im having troble validating a data base field the field is a key field in MS Access This is the function I have highlighted the offending code can anyone help?
function insertEntry( byref conn )
dim InstrID
dim TypeId
dim txtTitle
dim txtEntryDate
dim txtPassword
dim FirstName
dim LastName
dim txtStreetAddress
dim txtSuburb
dim txtState
dim txtBusinessPhone
dim txtEmail
dim iLength
dim iRecordId
dim rs
dim aInstrID
dim Sql
' read parameters.
InstrID = request("InstrID"
TypeID = request("TypeID"
txtTitle = request("txtTitle"
txtPassword = request("txtPassword"
FirstName = request("FirstName"
LastName = request("LastName"
txtStreetAddress = request("txtStreetAddress"
txtSuburb = request("txtSuburb"
txtState = request("txtState"
txtBusinessPhone = request("txtBusinessPhone"
txtEmail = request("txtEmail"
' open recordset.
Sql = "select from Instructors InstrID"
Set conn = Session("Learner_Connection"
set rs = Server.CreateObject("ADODB.Recordset"
rs.Open "Instructors", conn, 2, 3
aInstrID = rs.fields("InstrID".value
'check parameters.
if not rs.eof then
If aInstrID = InstrID Then
insertEntry = false
exit function
end if
end if
' create new recordset.
rs.AddNew
rs("InstrID" = InstrID
rs("TypeId" = TypeID
rs("txtTitle" = txtTitle
rs("txtEntryDate" =Now
rs("txtPassword" = txtPassword
rs("FirstName" = FirstName
rs("LastName" = LastName
rs("txtStreetAddress" = txtStreetAddress
rs("txtSuburb" = txtSuburb
rs("txtState" = txtState
rs("txtBusinessPhone" = txtBusinessPhone
rs("txtEmail" = txtEmail
rs.Update
' succeeded.
insertEntry = true
rs.Close
Set rs = Nothing
end function
function insertEntry( byref conn )
dim InstrID
dim TypeId
dim txtTitle
dim txtEntryDate
dim txtPassword
dim FirstName
dim LastName
dim txtStreetAddress
dim txtSuburb
dim txtState
dim txtBusinessPhone
dim txtEmail
dim iLength
dim iRecordId
dim rs
dim aInstrID
dim Sql
' read parameters.
InstrID = request("InstrID"
TypeID = request("TypeID"
txtTitle = request("txtTitle"
txtPassword = request("txtPassword"
FirstName = request("FirstName"
LastName = request("LastName"
txtStreetAddress = request("txtStreetAddress"
txtSuburb = request("txtSuburb"
txtState = request("txtState"
txtBusinessPhone = request("txtBusinessPhone"
txtEmail = request("txtEmail"
' open recordset.
Sql = "select from Instructors InstrID"
Set conn = Session("Learner_Connection"
set rs = Server.CreateObject("ADODB.Recordset"
rs.Open "Instructors", conn, 2, 3
aInstrID = rs.fields("InstrID".value
'check parameters.
if not rs.eof then
If aInstrID = InstrID Then
insertEntry = false
exit function
end if
end if
' create new recordset.
rs.AddNew
rs("InstrID" = InstrID
rs("TypeId" = TypeID
rs("txtTitle" = txtTitle
rs("txtEntryDate" =Now
rs("txtPassword" = txtPassword
rs("FirstName" = FirstName
rs("LastName" = LastName
rs("txtStreetAddress" = txtStreetAddress
rs("txtSuburb" = txtSuburb
rs("txtState" = txtState
rs("txtBusinessPhone" = txtBusinessPhone
rs("txtEmail" = txtEmail
rs.Update
' succeeded.
insertEntry = true
rs.Close
Set rs = Nothing
end function