Tiny bit of SQL prob

U

[UKLans]Khan

Guest
Hello all,

Do you have those days when you look at a bit of code so much that you can't see the problem :)

I need to select (in the statement below) all items that where entered before the date in the variable, it doesn't come up with an error but it also doesn't bring up the record I know are there.

The funny thing is, if I change it to >= TheVar it works, just doesn't like the <= thevar

Here's the little bugger :D

select * from Table1 INNER JOIN Table2 ON (Table1.fk_id = Table2.P_id) where fk_a_id =1 and The_Dte < 30/04/2003

I have changed the table names.

Thanks for any help guys,

Khan
 
U

[UKLans]Khan

Guest
Problem sorted, I went to lunch, go back and sorted it. I thought their must be another way around my problem so I filled a dataset with the data and then did the < than check.


tmpsql = "select * from Admin_Complete where fk_a_id =" & tmpid & " and AC_Dte >= " & var_df

Do until loop2 = var_numrows2
var_tmp_dte = dstmp.Tables(0).Rows(Loop2).Item("AC_Dte")
'***********HERE*************
If var_tmp_dte < var_dt then
var_numrows3 = var_numrows3 + 1
loop2 = loop2 + 1
Else
loop2 = loop2 + 1
End If
Loop

Thanks anyway,

Khan
 
O

old.LeitMotif

Guest
quick glance response..

I assume its an msdb of some form but did you try doing sommat with the date string.?

select * from Table1 INNER JOIN Table2 ON (Table1.fk_id = Table2.P_id) where fk_a_id =1 and (The_Dte < #30/04/2003#)

select * from Table1 INNER JOIN Table2 ON (Table1.fk_id = Table2.P_id) where fk_a_id =1 and (The_Dte < "#30/04/2003#")
 

Users who are viewing this thread

Top Bottom