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!

select on date value

Status
Not open for further replies.

fishman13

Programmer
Jul 8, 2002
73
US
What could be causing a syntax error in the following select. It was working fine until I added the start_date < checkdate. Both fields are date fields.


checkdate = cpermiss.user_date
this.rowsource = &quot;select carrier, priority, start_date ;
stop_date from insrec ;
where insrec.account == ;
thisform.txt_acct.value ;
and start_date < checkdate ;
order by priority into cursor cinsrec&quot;
Thanks
 
You are missing a comma after start_date in the first line.
 
You are indeed missing a comma as fluteplr says, but I don't think that's the cause of the syntax error.

It seems that the way your statement is coded generates a result of > 255 characters which, for some reason, FoxPro deems a syntax error.

Try it this way:

this.rowsource = &quot;select carrier, priority, start_date ;
stop_date from insrec ;
where insrec.account == ;
thisform.txt_acct.value and start_date < checkdate ;
order by priority into cursor cinsrec&quot;

Jim
 
fluteplr,

In my program I had the comma there, it was just a typo when entering it the forum. Something with the line
and start_date < checkdate ;
is causing the problem. If I remove it the select works. I am not sure if I need to do a join instead of using the checkdate value.
 
are both startdate and checkdate DATE type values?

Ali Koumaiha
TeknoSoft Inc
Farmington Hills, Michigan
 
I have changed the select to the following and it is working

checkdate = cpermiss.user_date
acctval=thisform.txt_acct.value

this.rowsource = &quot;select carrier, priority, start_date ;
stop_date from insrec ;
where insrec.account == acctval;
and start_date < checkdate ;
order by priority into cursor cinsrec&quot;

Is there a limit on the number of characters a rowsource can be set to. If there is, is there a way around this limit. I still need to add three move conditions.

Thanks
 
Hi fishman,

Are the data types the same. If not, convert one of the fieldname or the variable to a common format.

Since you are getting a syntax error, the format is the problem :)

start_date < CTOD(checkdate) .. could solve the problem.

:)

ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com

 
I believe that your new statement works because it yields < 255 characters.

The use of semicolons and indenting in the statement generates extra blanks in the final result as in

&quot;select carrier, priority, start_date, stop_date&quot;

By combining multiple lines you can shorten your Rowsource string considerably.

Jim

 
It appears to be the lenght of the row source string. I added another condition and received the syntax error again. I then replace the
select carrier, priority, start_date, stop_date
from insrec

with

select * from insrec

and the syntax error did not appear.

Looks like a need to find a new way to enter the rowsource.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top