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!

Create SQL View no records returned

Status
Not open for further replies.

Puebles

Programmer
Feb 3, 2016
14
US
Hello,

I am trying to replicate a program I had used from memory. As I recall I had this issue when I first wrote it. The problem is that I am accessing remote data that has a datetime field and I want only the records for today. So, I used CREATED>date(). But, I get no records. Yes, there is data in the remote view for today. I run the same query (different SQL) in Access and get the proper data returned.

Here is the test code:
CLOSE DATABASES all
CLOSE TABLES all
OPEN DATABASE data2

CREATE SQL VIEW MyView REMOTE CONNECTION Connect1 as ;
SELECT RemTable.TRACKING_NUM, ;
RemTable.STATUS, ;
RemTable.CREATED, ;
RemTable.MODIFIED ;
FROM Schema.RemTable RemTable ;
where RemTable.CREATED > DATE()

=MESSAGEBOX("Done")

DELETE VIEW MyView

What did I forget?

Thank you in advance.
 
You can't use a VFP function DATE() on a remote backend. You could run it with a parameter:

Code:
where RemTable.CREATED > ?m.refdatetime

Then set [tt]refdatetime = DATE()[/tt] and USE or REQUERY() the view.

Bye, Olaf.





Olaf Doschke Software Engineering
 
Thank you all. Olaf's method worked.

Question answered.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top