Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Query

Status
Not open for further replies.

Sheriff

Programmer
Sep 1, 2001
34
US
I'm having a proplem with Query for access with vb6. The Query returns records that are the range but the year is off. example if sBeginDate = "01/01/02" and sEndDate = "03/31/02" the records also include 01/01/01 as well as 01/01/02
I am using the MS MaskEdit control to input the date

This is the query:

MySql = "SELECT [Services].[AccID], [Services].[InstRprD], [Services].[Brand], [Services].[AptNo], [Services].[InModel], [Services].[InSerial], [Services].[OutModel], [Services].[OutSerial], [Services].[Warranty], [Services].[Amount]"
MySql = MySql & " FROM Services"
MySql = MySql & " WHERE Services.InstRprD Between " & Chr(34) & sBeginDate & Chr(34) & " And " & Chr(34) & sEndDate & Chr(34)

MySql = MySql & " ORDER BY [Services].[InstRprD]"
Set rsSer = db.OpenRecordset(MySql, dbOpenDynaset)

Any help would be greatly appreciated
Thanks in advance
Sheriff

 
It would appear that your Begin and End dates are not real dates - just strings that LOOK like dates, thus "01/01/01" is between "01/01/02" and "03/31/02"

I am unfamiliar with the MaskEdit control, but it would seem that you are storing strings, not real dates. Is this the case?

How many of you believe in telekinesis? Raise my hand...
Another free Access forum:
More Access stuff at
 
Hi, WildHare
Yes it is Strings, However the exact Query (except table name) produced correct results in another VBP, that why I'm baffled, I'm still in the learning stage. The Mask Edit controls allows set setting a mask (##/##/## and the format ddddd) in the properties. I'm always open to a better or more efficient way to get results. Any Suggestion, code sniplets, etc. would be appreciated.
Thanks

Sheriff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top