Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP error 80040e21: "Undefined Status Value" 1

Status
Not open for further replies.

URLJones

Programmer
Jun 14, 2004
42
CA
Hi, I'm hoping someone can help me. I have created an Access database and I am trying to add a record to it through ASP. Here's part of the code I have:

Dim connect, data_s, onMenu, Query, systemcheckRS

set connect = Server.CreateObject("ADODB.Connection")
data_s = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("StatusLog.mdb")
connect.Open data_s

set systemCheckRS = Server.createObject("ADODB.Recordset")
Query = "SELECT * FROM StatusLog"
systemCheckRS.Open Query, connect, 3, 3

systemCheckRS.AddNew
systemCheckRS("System_Type") = Request.Form("RadioGroup1")
systemCheckRS("System_Status") = Request.Form("statusGroup")
systemCheckRS.Update
connect.close

If someone can help, that would be very much appreciated.

Thanks,

-- URL
 
you could make your life a bit easier in this situation if you tried less options :)

all this
Code:
Dim connect, data_s, onMenu, Query, systemcheckRS

set connect = Server.CreateObject("ADODB.Connection")
data_s = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("StatusLog.mdb")
connect.Open data_s

set systemCheckRS = Server.createObject("ADODB.Recordset")
    Query = "SELECT * FROM StatusLog"
    systemCheckRS.Open Query, connect, 3, 3
    
    systemCheckRS.AddNew
    systemCheckRS("System_Type") = Request.Form("RadioGroup1")
    systemCheckRS("System_Status") = Request.Form("statusGroup")
systemCheckRS.Update
connect.close

can be reduced to :
Code:
[green]'Dims[/green]
Dim connect, data_s, onMenu, Query, systemcheckRS

[green]'Open Connection[/green]
set connect = Server.CreateObject("ADODB.Connection")
connect.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("StatusLog.mdb")

[green]'Insert Data[/green]
set systemCheckRS = connect.execute("Insert into Statuslog(System_type,System_Status) values('" & Request.Form("RadioGroup1") & "','" & Request.Form("statusGroup") & "')

[green]'Clean Up[/green]
set systemCheckRS = nothing
connect.close
set connect = nothing

[thumbsup2]DreX
aKa - Robert
 
Thanks DreX, but, I tried what you posted and I still got the same error. Only, this time, I get a different error code, namely:

Microsoft JET Database Engine error '80004005'

"Undefined Status Value"

If there are any more suggestions, it would be very much appreciated.

What I was thinking was maybe it's something to do with one of my values that I'm trying to put into the table. Is that what "Status Value" refers to?

Thanks,

--URL
 
you may need to update this statement as such, also make sure it says valueS not value in yours

set systemCheckRS = connect.execute("Insert into [Statuslog]([System_type],[System_Status]) values('" & replace(Request.Form("RadioGroup1"),"'","''") & "','" & Replace(Request.Form("statusGroup"),"'","''") & "')")

looks like that statement was missing a trailing paren and quote as well

[thumbsup2]DreX
aKa - Robert
 
Thanks DreXor. I try that too (puting the filed names in "square" parenthises". It didn't do much good. I did happen to change the

connect.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("StatusLog.mdb")

into

connect.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("StatusLog.mdb")

but, I still got the same sort of error, only this one was related to the Access driver and not that Microsoft.Jet.OLEDB.4.0 provider. The error looked like this:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access Driver] "Undefined Status Value"


It's that "Undefined Status Value" that I'm not too sure on. The error occurs at connect.execute(...)

I don't know if that helps in solving the problem.
If there are more suggestions, just let me know!

Thanks!

--URL
 
hmm try remming the connect.execute statement, and try something else, like retrieve a small recordset and response write out something, that's an odd error, i'm seeing nothing wrong in the sql statements ( at least that i can see )
perhaps the db might be a little corrupt? has something in the DB changed? is there a field named [status] that is required?


[thumbsup2]DreX
aKa - Robert
 
no, I have a field that is called "SystemStatus", but that is about it. I was kinda thinking it was something with regards to the ADODB.connection or ADODB.recordset object. Maybe I'm not setting some status value in there. Either that or maybe I need to update some of the drivers and whatnot on my system here. Only, I have limited access priveleges to the computer I am using because I am at work :(.

I'm still unsure as to what to do.

Thanks again.

--URL
 
Ok. problem solved...If anyone else has this same problem, all I did was change the permissions of the folder that the database was in, and the permissions for the actual database. I also had two tables in the database, so, I split the two tables up into two different files. Everything works great now. Here's the link I used to change the permissions:


Thanks again DreX for your time!

--URL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top