AllExperts > Experts 
Search      

Visual Basic

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Visual Basic Answers
Question Library

Ask a question about Visual Basic
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Ravindra
Expertise
visual basic application programming from design to access information, sql, engineering and commercial applications. access databases, excel. Optional: 1)a large number of people want me to do work which takes some time and effort. Pl.note that i would like to be paid for such work. 2) if you want me to spend quality time and do special work, i expect to be paid a reasonable price for my time. 3) if you are pleased with my reply you could consider a donation of 1$. 4) you can visit my website http://ravindra.coolpage.biz (under constrn)

Experience

Past/Present clients
project work for a Norway company, and a Canadian company completed. Freelance Project work and Teaching
teaching vb

 
   

You are here:  Experts > Computing/Technology > Basic > Visual Basic > Execution of between operator of access through vb 6.0

Topic: Visual Basic



Expert: Ravindra
Date: 6/17/2008
Subject: Execution of between operator of access through vb 6.0

Question
"i have two dtpicker and one cmdbutton in my application and i want display the datareport according to the date,for that i written the following code.

DataEnvironment1.rsdipostava.Open "select * from TblDipostavaDetails where recdate between '" & DTdipfrom.Value & "' and '" & DTdipTo.Value & "'", DataEnvironment1.report, adOpenDynamic, adLockOptimistic.,

The data type in the database is datetime format and it is in the form of mm/dd/yyyy/,but while executing the query i am getting the error as "datatype mismatch  in criteria expression".plz help me to answer this question."

Answer
your code is too simplistic. it wont work. the date between 2 dates produces errors in datareport.

change to access report

sample code for datareport between 2 dates.

in command properties of dataenvironment ..enter
SELECT * From TblDipostavaDetails WHERE recdate >? and recdate <?
'exactly as it is
save the de. drag these fields to the data report

to a form add a button and code
if text1 ="" or text2 ="" then exit sub
With DataEnvironment1
.Command1 CDate(#1/1/2002#), CDate(#10/5/2003#)
' here you can use   .Command1, cdate(text1),Text2)
End With
DataReport1.Show


it runs perfectly but even you make a small error,  it wont produce the report

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.