By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,631 Members | 1,362 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,631 IT Pros & Developers. It's quick & easy.

help for date in query

P: 1
Expand|Select|Wrap|Line Numbers
  1. S = "select count(*) as aa from no_of_pracs  where  "
  2. S = S & "batch like '" & pracs_1(0) & "' and "
  3. S = S & "month_of_pracs ='" & MonthView1.Month & "'"
  4.  
  5. Adodc1.RecordSource = S
  6. Adodc1.Refresh
  7. Adodc1.Recordset.MoveFirst
  8.  
  9. b = Adodc1.Recordset.Fields(0).Value
for this code i m getting "datatype mismatch in expression"

for monthview1.month.............how to solve thsi
Apr 4 '07 #1
Share this Question
Share on Google+
2 Replies


iburyak
Expert 100+
P: 1,017
What datatype month_of_pracs ?

If it is numeric datatype change tihs:


[PHP]S = S & "month_of_pracs ='" & MonthView1.Month & "'"[/PHP]

to this:

[PHP]S = S & "month_of_pracs = " & MonthView1.Month [/PHP]

Good Luck.
Apr 4 '07 #2

Expert 5K+
P: 8,434
As iburyak pointed out, numeric values don't have quotes around them in SQL (or elsewhere, generally). If this solves the problem, fine.

Otherwise, please tell us: are you getting this error when compiling the code, or returned when the database tries to execute the SQL? And what is MonthView - a calendar control?

For that matter, what is this code written in? VBA in MS Access? Standalone VB6?
Apr 5 '07 #3

Post your reply

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