Hello Andy:

I may be wrong as I am still pretty new to SQL, but when you use the
Insert command explicitly, don't the variable values in the VALUES part
of the statement have to match up with the field names in the INTO part
of the statement. It does not look like yours do therefore giving you
the wrong data type when you get to RANK.

Have a great day

Larry Hough


-----Original Message-----
From: Andy Hayman [mailto:[EMAIL PROTECTED]] 
Sent: Monday, August 12, 2002 5:48 AM
To: ActiveServerPages
Subject: Probs adding a record using SQL to Access

Something is going wrong, I am getting "Data type mismatch in criteria
expression.", which must be due to the "Rank" pulled from a dropdown
box,
the code works in other ASP apps I have done, sure it is something
stupid,
the write(rank) line is giving 3 (Rank being 1) so it is a number.

PlayersName=trim(request("PlayersName"))
CharacterName=trim(request("CharacterName"))
Position=trim(request("Position"))
Rank=trim(request("Rank"))
Rank=cInt(Rank)
Rank=Rank+2
Password=trim(request("Password"))
Description=trim(request("Description"))
Title=trim(request("Title"))
Phone=trim(request("Phone"))
Email=trim(request("Email"))
WhichGroup=Session("Group")

response.write(Rank)

Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "DSN=Lions"

SQLstmt = "INSERT INTO Members
(PlayersName,CharacterName,Position,Title,Rank,Password,Description,Phon
e,Em
ail,WhichGroup)"
SQLstmt = SQLstmt & " VALUES (" 
SQLstmt = SQLstmt & "'" & Position & "',"
SQLstmt = SQLstmt & "'" & PlayersName & "',"
SQLstmt = SQLstmt & "'" & CharacterName & "',"
SQLstmt = SQLstmt & "'" & Phone & "',"
SQLstmt = SQLstmt & "'" & Title & "',"
SQLstmt = SQLstmt & "'" & Email & "',"
SQLstmt = SQLstmt & Rank & ","
SQLstmt = SQLstmt & "'" & Password & "',"
SQLstmt = SQLstmt & "'" & Description & "',"
SQLstmt = SQLstmt & "'" & WhichGroup & "'"

SQLstmt = SQLstmt & ")"

Set RS = conn.execute(SQLstmt)

---
Andy Hayman
Kensington Computers
Internet & Computers Systems Consultant
Web             <http://www.ken.co.uk>
Email           <mailto:[EMAIL PROTECTED]>
Telephone       020 7835 1282
Fax:            020 7373 6900

Disclaimer 
This e-mail is confidential and intended solely for the use of the
individual to whom it is addressed. Any views or opinions presented are
solely those of the author and do not represent those of Kensington
Computers. If you are not the intended recipient, be advised that you
have
received this mail in error and that any use, dissemination, forwarding,
printing or copying of this e-mail is strictly prohibited. 

---
You are currently subscribed to activeserverpages as:
[EMAIL PROTECTED]
To unsubscribe send a blank email to
%%email.unsub%%


---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to