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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

deleting record by id number for access

Status
Not open for further replies.

scottRen

Technical User
Feb 4, 2005
69
0
0
CA
this is what i have:

id = request.form("event_id")
//when i response.write the id i currently get a 40 value,
//i concure with the db and the 40th record does exist

Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\path\der.mdb;"
Set rs = conn.Execute("DELETE FROM calender_event WHERE event_id='" & id & "'")

//event_id is a column name in the db with autoNumber,
//long interger with no duplicates set

the error:

Microsoft JET Database Engine error '80040e07'
Data type mismatch in criteria expression.
//with error p[ointing to the sql statement

thanks
 
remove the "'"

("DELETE FROM calender_event WHERE event_id=" & id )
 
If that doesn't solve it then do this as well
Code:
id = [red]CInt([/red]Request.Form("event_id")[red])[/red]
This will force the value to the same datatype as your autonumber field that you are comparing with in your SQL statement.

Definitely remove the single quotes from your SQL statement as Steven suggested.

Tony
[red]_________________________________________________________________[/red]
Webmaster -
 
don't you guys ever get tired of being right?!!! ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top