Click here to Skip to main content
Sign Up to vote bad
good
See more: VB6VBSQL
Hi,
 
I'm creating a Raffle Program using VB6.
I'm having trouble updating the data in MDB. This is the error when executing the SQL
Data type mismatch in criteria expression.
UPDATE WINNERS SET PrizeClaimed='1' WHERE RaffleNumber=461 AND [Date]='11/21/2012 11:12:52 PM'; 
 
This is the query I use in adding the record. Don't know why the above SQL won't run. I just add record using the same dates '11/21/2012 11:12:52 PM'
INSERT INTO WINNERS([RaffleNumber], [PrizeClaimed], [Date]) VALUES('461', '0', '11/21/2012 11:12:52 PM');
 
Can anyone post why this happens...
 
Thanks
Posted 21 Nov '12 - 4:24


3 solutions

I try experimenting
I use this # and it works
UPDATE WINNERS SET PrizeClaimed='1' WHERE RaffleNumber=461 AND [Date]=#11/21/2012 11:12:52 PM#; 
  Permalink  
It appears your INSERT statement has the values as strings, and the UPDATE as Raffle Number is a number,
 
Try
 
UPDATE WINNERS SET PrizeClaimed='1' WHERE RaffleNumber='461' AND [Date]='11/21/2012 11:12:52 PM'; 
 
See if that helps.
  Permalink  
Comments
hansoctantan - 22 Nov '12 - 2:35
same error occur... :(
Always use # when using dates.
eg #21/03/2012#
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 206
1 Richard MacCutchan 145
2 Tadit Dash 140
3 Sergey Alexandrovich Kryukov 135
4 Santhosh G_ 125
0 Sergey Alexandrovich Kryukov 10,294
1 OriginalGriff 7,955
2 CPallini 4,201
3 Rohan Leuva 3,522
4 Maciej Los 3,159


Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 2 Dec 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid