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

How can i add Search option in form

Status
Not open for further replies.

muraliambt

Programmer
Jan 22, 2002
75
0
0
US
I want to add search button, when the user click it , it should display the required fields of the table (like all Product code and name ) and i am able to move over the details and whenever i move it should display the other detail of product in form.

Murali.
 
I'm having trouble understanding exactly what you want to do, but I'll give it a shot.

I assume this is a single table. You should use a Grid to display the columns you want (Product Code and Product Name) and then use other controls to display the detail fields. These fields should all have their ControlSource property set directly to the table fields. In your AfterRowColumnChange event on the Grid, you will want to Refresh() those fields. My favorite trick is to put all of those controls in a container and call Thisform.Container.Refresh() when the grid moves.

When the user clicks the SEARCH button, just do a SEEK on the value that was entered, then REFRESH() and SETFOCUS() on the grid.

Hope that helps!

Ian
 
May be i will put in simple way. when the user cliks the search button, there should be one windows with the details. ex. assume i have product table with pr_code, pr_name, pr_output, pr_good etc..

so. i will display only the pr_code and pr_name in the windows. basically it should be the popup window. so when i move to details in popup windows it should disply the other details also in the form.
 
So, you have a form with fields on it. Do you want a Search button on the form to pop up a window that lists the possible records and to have the original form update as you move through the records in the popup window?
 
Use an PageFrame, the first page with the Data (pr_code and pr_name ). In the other, a Grid with the fields pr_code, pr_name, pr_output, pr_good etc..
In the Click Event of Button Search:
THISFORM.PageFrame.Page2.Activate.
In the Deactivate Event of Page2:
THISFORM.Refresh()
The user could make click in Page2 to Search, or Click in the Page1 to Finish the Search..
That do you seem this?
 
Honestly, what you're looking for is fairly complex.

You would have to create a form that is Modeless (WindowType=0), AlwaysOnTop, has a property for ParentForm, and a grid on it for the records you want. Execute it with a "DO FORM WITH THIS". The INIT() method would look something like this:
Code:
lparameters oParent
THISFORM.ParentForm=oParent
In the grid AfterRowColumnChange event put this:
Code:
THISFORM.ParentForm.REFRESH()
That should work. *crosses his fingers*

The tricky part is to make sure you close the forms together. If the grid form is still up when the other one is closed it will crash.

Ian
 
thanks Ian and lucin.

i will try both of the suggestions. i feel Ian suggestion i good.

Murali.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top