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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

criteria: date(11/09/2000) < textdate(20001110) (TRUE)

Status
Not open for further replies.

jackiev

MIS
Aug 16, 2000
56
0
0
US
Have 2 'date' fields in a table.
One is date/time data type : 11/09/2000
Second is text data type: 20001109
(Tables are populated elsewhere and frequently appended, so I cannot change data types in the table)
Is it possible to create criteria for a query field that
will successfully compare the two?
that is: date1 = #11/09/2000#
date2 = 20001110
date1 < date2 = TRUE.

I tried: date1 < (Format(date2,&quot;Long Date&quot;))
and date2 < (Format(date2,&quot;Short Date&quot;))
but these give me 'type mismatch errors' ANY IDEAS?
 
Try with that:

Dim sDate1 as String

date1 = #11/09/2000#
sdate1 = year(date1) & day(date1) & month(date1)

My e-mail is: vzudaire@yahoo.com
 
Try comparing the datevalues of these two dates as in :
where datevalue(date1)<datevalue(date2)

PK Odendaal
pko@mweb.co.za

 
hi i am having the table structure as follows

Employee Id, Date Worked, Project Id, Hours worked.


I would like to get the result on the basis of week wise of one particular month. How to frame this query

Thanks

 
If you haven't resolved this yet, try:

Code:
Date1 = #11/09/2000#
Date2 = &quot;20001110&quot;

MyYr = Left(MyDateStr, 4)
MyMnth = Mid(MyDateStr, 5, 2)
MyDay = Right(MyDateStr, 2)
MyDate = DateValue(MyYr & &quot;/&quot; & MyMnth &&quot;/&quot; & MyDay)

? MyDate
11/10/00

? (Date1 < Date2)
True

Of course, you need to add the formalities (dim stmts for all of the My* vars). It would probably be best to isolate the conversion of the string to date conversion in a function call, however from the original problem statement, I would infer that you may need to do a somewhat more robust version (various 'formats' of the incomming string/date?) to accomodate the variations on the theme.




MichaelRed
mred@duvallgroup.com
There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top