1) Does the data have single quotes in it?
2) What does the UpdateCommand and InsertCommand look like?
Bob
Main Topics
Browse All Topics Hello experts
I am creating a website using VWD and an Access database. I am having a problem when attempting to update a record in my database.
The error I am getting is:
"Data type mismatch in criteria expression."
The error is thrown at this line of code:
da1.Update(ds1)
I've added some message boxes to show the current dataset value and it is updating correctly, however when it trys to update the actual database it dies.
Here is the code.
Dim ds1 As New Data.DataSet()
Dim SQL1 As String = "SELECT Week1.[1], Week1.ID FROM Week1 WHERE (((Week1.Username)=" & """" & Username & """" & "));"
Dim da1 As New Data.OleDb.OleDbDataAdapte
da1.Fill(ds1)
Dim cb1 As New Data.OleDb.OleDbCommandBui
'For debugging purposes
MsgBox("The dataset is currently: " & ds1.Tables(0).Rows(0)("1")
ds1.Tables(0).Rows(0)("1")
'For debugging purposes
MsgBox("The dataset is now: " & ds1.Tables(0).Rows(0)("1")
da1.Update(ds1) <---- here is where the error is thrown
Ive spent four hours trying to figure this out! Please help!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hello
try changing data type of your required fields from the one u have selected to chararray or text or string or something to the effect available in dropdown list of the field type of the access database. you probably need to change all the fields which are likely to be affected. I will appriciate if you post the access table design view as well, so that it is more clear. but i'm pretty sure changing the data type to string or something to the effect in the database will surly resolve your problem. be careful, there might be data loss when attempting to change the fields. backup your table if you have data in it.
Hummm, We could try this....
Since you've got a strange column name (you rarely see a number as a column name) I'd bet the UpdateCommand and InsertCommands are throughly confused. So I'd suggest that you set the QuotePrefix and QuoteSuffix properties like this:
cb1.QuotePrefix = "["
cb1.QuoteSuffix = "]"
http://msdn2.microsoft.com
BTW: Renaming the column would be my first choice
Business Accounts
Answer for Membership
by: Nanda1Posted on 2006-07-24 at 00:31:07ID: 17165904
I think there is a mismatch between the tables datatype and the value you are sending
for example
empty string value in the command text (SQL) cannot be stored in MS Access' "Date/Time"
Go thro' this link
http://www.xlinesoft.com/a
http://support.microsoft.c
Thanks,
Nanda