×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Foxpro Searching
2

Foxpro Searching

Foxpro Searching

(OP)
Can anybody teach me on how to create a visual foxpro program that will search from a textbox and it will automatically display in a grid.For example i am searching for the lastname of employee when i enter "SMI" all the "smi" lastname will display in a grid. Thankyou for your response. Im a newbie in foxpro

RE: Foxpro Searching

Quote:

Can anybody teach me on how to create a visual foxpro program that will search from a textbox and it will automatically display in a gri

No. That's not how the forum works. We will be happy to answer specific questions and to try to solve problems. But we don't provide tutorials or teach how to write programs.

I suggest you try to work out the basics for yourself, and come back here when you have a specific question.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: Foxpro Searching

I think you're interpreting that question as far to broad.
There are code samples coming with VFP, you find them in the Task Pane as "Solution Samples", searchable.

And one sample that you might like is in the VFP directory at samples\solution\ffc\datasort.scx
About Sorting and filtering data.

Bye, Olaf.

Olaf Doschke Software Engineering
https://www.doschke.name

RE: Foxpro Searching

Mike is right. However, to get you off the ground, here is a possible way to populate a grid with selected records from a table.

Suppose you have an open table with the ALIAS customer. The fields of this table include the customer’s name Custname, his Account code, a Postcode and the outstanding Balance on the account.

Create a new form with a textbox txtPrefix, into which the user will enter the first few characters of the customer name (its Format property should be ‘!’ – without the quotes); a command button cmdSearch with caption ‘Search’; and a grid grdresult with its Colcount property set to 4 and its Deletemark set to .F..

Then in the Click() method of cmdSearch, place code something like this :

CODE -->

LOCAL lPrefix
WITH Thisform
   lPrefix = RTRIM(.txtPrefix.value)
   SELECT Account, Custname, Postcode, Balance ;
         FROM Cus WHERE UPPER(Cus.custname) = lPrefix INTO CURSOR cSubset
   .grdResult.RecordSource = "cSubset"
   .grdResult.Refresh()
   ENDWITH 

You could include code after the SELECT statement to check that there was at least one record in the cursor cSubset which you have created.

If the rule for extracting records to be placed in grdresult was a little more complicated, you could equally replace the SELECT-SQL statement above with statements to create an empty cursor and then populate it with a SCAN through the Customer table.

I hope this helps. Good luck Su.

Andrew

RE: Foxpro Searching

Dear Sir
this code in object(text1) procedure( interactichange)

SELECT m.stfno as 'EmpNumber',m.name1 as 'First_Name',m.name2 as 'Second_Name',m.name3 as 'Last_Name' FROM MASTER m ;
where ALLTRIM(name1)+" "+ ALLTRIM(name2)+" "+ ALLTRIM(name3)=ALLTRIM(thisform.text1.Value);
ORDER BY 1;
into CURSOR grid1
THISFORM.grid1.RecordSource='grid1'
thisform.grid1.SetAll("DynamicBackColor", ;
"IIF(MOD(RECNO( ), 2)=0, RGB(0,255,255) ;
, RGB(0,255,0))", "Column") && Alternate white and green records
THISFORM.grid1.Visible= .t.
thisform.grid1.FontSize = 10
THISFORM.grid1.Refresh
THISFORM.Refresh


Best Regards
Husean Zghair

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close