Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 25th, 2010, 02:54 AM
Registered User
 
Join Date: May 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Plz help me with this code

Private Sub cmdGenRep_Click()
On Error GoTo errhandler
fdt = dtpFdate.Value
tdt = dtpTdate.Value
If cmboCountry(1).Text <> "-- Select Country --" Then
country = cmboCountry(0).Text
ElseIf cmboCountry(1).Text = "-- Select Country --" Then
MsgBox "Please Select Country", vbInformation, "Message"
cmboCountry(1).SetFocus
Exit Sub
End If
Call openStudent_Master
Set rsRep = New ADODB.Recordset
MsgBox dtpFdate.Value
MsgBox dtpTdate.Value
' str = "select stu_id,fname,lname,Con_Resi_stdcode,Con_Resi_no,Co n_Mo,course_preferred,comments from Student_Master where reminder BETWEEN " + dtpFdate.Value + " and " + dtpTdate.Value
str = "select stu_id,fname,lname,Con_Resi_stdcode,Con_Resi_no,Co n_Mo,course_preferred,comments from Student_Master where reminder > '" & dtpFdate.Value & "' and reminder < '" & dtpTdate.Value & "'"
MsgBox str
rsRep.Open str, cn, adOpenStatic, adLockReadOnly
Set drVA.DataSource = rsRep
errhandler:
MsgBox Err.Description
MsgBox Err.Number
End Sub
 
Old May 25th, 2010, 02:57 AM
Registered User
 
Join Date: May 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error Number 13 Data type mismatch

Actually I want to generate date wise report. My back end tool is MS Access.
I have a field named reminder which stores reminder date and whose data type is date/time.But while retrieving form database I am getting run time error 13 data type mis match . .
 
Old May 25th, 2010, 03:42 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Please try

Str = "select stu_id,fname,lname,Con_Resi_stdcode,Con_Resi_no,Co n_Mo,course_preferred,comments from Student_Master where reminder > " & CDate(dtpFdate.Value) & " and reminder < " & CDate(dtpTdate.Value) & ""

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips &amp; Tricks (http://www.vbadud.blogspot.com)
 
Old May 26th, 2010, 02:14 AM
Registered User
 
Join Date: May 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Hey . .

The Query you gave is not working for me . .
Plz help me out through this. .I would be grateful . .

Harsh
 
Old May 26th, 2010, 08:36 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Can youy please tell me if Is it throwing the error or is it not giving any result?

Can you try one part / other and try if it is leading you anywhere

Str = "select stu_id,fname,lname,Con_Resi_stdcode,Con_Resi_no,Co n_Mo,course_preferred,comments from Student_Master where reminder > " & CDate(dtpFdate.Value)

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips &amp; Tricks (http://www.vbadud.blogspot.com)
 
Old May 26th, 2010, 08:45 AM
Registered User
 
Join Date: May 2010
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Wink Heyy. .I got through

I used # around date values

Harsh
Thanks for all your reply





Similar Threads
Thread Thread Starter Forum Replies Last Post
plz.....plz solve out my problem.... kethireddy435 ASP.NET 1.x and 2.0 Application Design 1 October 4th, 2007 12:56 PM
hi plz help me gauravkg ASP.NET 1.0 and 1.1 Basics 0 April 18th, 2006 01:17 AM
Email through vb code Plz give me reply sachinbashetti General .NET 0 September 23rd, 2005 04:27 AM
ColdFusion MX 7 Login page code--Plz help colorfeifei Dreamweaver (all versions) 0 February 23rd, 2005 11:51 PM
Plz Help Me Check What's Wrong Of This Code ! ck C++ Programming 1 January 13th, 2005 12:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.