- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsI have a form whereby I want to enable a search feature. I have two edit boxes one to search by surname and one to search by employee number. The remainder of the fields on the form are dbedits which look at a database and display the appropriate results.
Is there a way to have the dbedits start off empty and allow a user to enter the search criteria or will I have to use regular edit fields. I have tried disabling the Datasource i.e.
Datasource.enabled := false
this seems to work but an error noise is made when the form is displayed suggesting something is wrong. Maybe a solution is to link the fields to the database after the form has been displayed but this seems like a lot of code for what I want to do which is start with the fields empty. When the search results are returned the dbedit fields should be returned with the data from the query.
Secondly when the datasource is disabled I cannot enter any search criteria in a dbedit field is this possible or do I need to change this to an edit field not linked to the database??
Hope this makes sense
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: developmentguruPosted on 2007-07-30 at 05:11:16ID: 19591777
Ok, they should definitely be TEdit instead of TDBEdit. Once you find your results just populate the two edits. Depending on your situation you can use a Dataset.Locate to find the record instead of a query.
One other suggestion... Instead of having edits that show the results, use a DBGrid. There can be multiple partial matches for a search. Seeing them all can help the user refine, or end, their search (by selecting a visible record). In the caseof using a grid for the results you can use a filter or a query.
Let me know if you need more.