473,398 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

visual basic data type mismatch in criteria expression??

i cant find the problem can anyone help me pls???


If userNameTextBox.Text <> "" Then
Dim sqlQRY As String = "INSERT INTO SalesOrder Values ('" & salesNoTextBox.Text & "', '" & orderDateTextBox.Text & "', '" & userNameTextBox.Text & "', '" & productCodeTextBox.Text & "', '" & quantityTextBox.Text & "')"
Try
conn.Open()
Dim cmd As OleDbCommand = New OleDbCommand(sqlQRY, conn)
cmd.ExecuteNonQuery()
Catch ex As OleDbException
MsgBox("Error: " & ex.ToString & vbCrLf)
Finally
conn.Close()
End Try
saveButton.Enabled = False
Else
MsgBox("Please select customer")
userNameTextBox.Focus()
End If
Dec 23 '11 #1
7 4710
Rabbit
12,516 Expert Mod 8TB
It's probably because you're trying to insert a string into that date field. But I have no idea because you haven't told us what the data types are for your fields.
Dec 23 '11 #2
i am doing a sales order form. pls help!!!
Dec 23 '11 #3
Rabbit
12,516 Expert Mod 8TB
I did help. I helped all I could given the information that was provided.
Dec 23 '11 #4
so may i know which code i have to change?
Dec 23 '11 #5
Rabbit
12,516 Expert Mod 8TB
I don't know what you have to change. I can only guess at the error because I don't have everything I need to know to pinpoint the error.
Dec 23 '11 #6
Try this and let me know if it works.....

"INSERT INTO SalesOrder Values ('" & salesNoTextBox.Text & "', '" & Convert.ToDateTime(orderDateTextBox.Text) & "', '" & userNameTextBox.Text & "', '" & productCodeTextBox.Text & "', '" & quantityTextBox.Text & "')"
Dec 24 '11 #7
Killer42
8,435 Expert 8TB
I wonder whether putting hashes (#) around the date value might help.

But yeah, what we really need is more info about the circumstances.
Dec 24 '11 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: ArcadeJr | last post by:
Good morning all! I have been getting a Run-time Error message #3464 - Data Type mismatch in criteria expression. While trying to run a query. I have a database where the field Asset_Number...
4
by: N J | last post by:
Hi, CurrentDb.Execute "Update tblDelayedOrders Set DELAYED = True Where ID = " & Me.txtOrderNumber & ";", dbfailonerror Me.StatusListBox.AddItem "ORDER # " & Me.txtOrderNumber & " MARKED AS...
3
by: martlaco1 | last post by:
Trying to fix a query that (I thought) had worked once upon a time, and I keep getting a Data Type Mismatch error whenever I enter any criteria for an expression using a Mid function. Without the...
1
by: amitbadgi | last post by:
I am getting the following error while converting an asp application to asp.net Exception Details: System.Runtime.InteropServices.COMException: Data type mismatch in criteria expression. ...
2
by: technocraze | last post by:
Hi guys, Implementations application & programming environ MS Acess + Visual Basic Table fields Serialno (pk) - Auto number StudentId - text Course - text intake - number
10
by: aaronrm | last post by:
I have a real simple cross-tab query that I am trying to sum on as the action but I am getting the "data type mismatch criteria expression" error. About three queries up the food chain from this...
2
by: psychomad | last post by:
Please, can someone help me out to solve this error, i've been searching throughout my codes and yet i didnt succeed in finding the error!!!! The Error is: Server Error in '/' Application....
19
by: Lysander | last post by:
I have written a query that takes three integers representing day,month and year, forms a date from them and compares this date to the date the record was entered and returns any records where the...
1
by: DC | last post by:
Any idea why this code would cause a error? The SQL that gets executed seems to be (using record 1132 as an example) DELETE FROM user_table WHERE ID = '1132'; And the value of...
2
by: tmoon3 | last post by:
Hello, This must be a simple mistake, but for some reason I cannot seem to get around it. I am simply trying to create a report of all employees that have a date filled in in a training column...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.