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

SQL Select only displaying first record

Status
Not open for further replies.

KDavie

Programmer
Joined
Feb 10, 2004
Messages
441
Location
US
I have a grid that I am using a SQL Select statement on for the recordsource. The problem is that the select statement is only returning the first record where the like condition is true. Here is my code:

SELECT * FROM COLLHEAD WHERE lastname_a LIKE lcLast INTO CURSOR Collhead

How can I get the SQL Select statement to return all the records where the like condition is true?

Any help would be appreciated.

-Kevin
 
Kevin,
There seems nothing wrong with your coding, it works fine when I run it. Are you sure more than 1 reccord matches your condition?
Koen
 
Yeah, I'm sure. But I have it working now. I didn't do anything different to the code though. I just closed VFP and reopened it and now it works fine. This is a bit unsettling because it seems to me that it will probally happen again, but I have no idea where the problem could be. Anyways, thanks for replying.

-Kevin
 
Hi Kevin,

Perhaps you have more than 1 table named COLLHEAD?


Jim
 
Kevin,

Could it be that, the first time you ran it, the table was buffered? If so, and if you made changes to the table without committing them, SELECT will not see those changes.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
The Select statement is used on a view as opposed to a table. It is used as the recordsource behind a readonly grid, so there weren't any changes to the data. I was using the views name for the INTO clause of my statement though for example:

SELECT * FROM MyView INTO MyView

I changed it to:

SELECT * FROM MyView INTO MyView1

and I haven't had anymore problems with it.

Thanks everyone for your help.

-Kevin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top