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

Search box - actions after update

Status
Not open for further replies.

Garyeag

Technical User
Mar 23, 2001
32
GB
I have an invoice form with 3 search boxes which enable the user to locate the record to invoice. They can find a particular record using the company's name, the name of the project the company has commissioned, or the project code. However, each of these search boxes are independent.

a) Is it possible to link all three (other than in a list box) and have each so that they are ordered alphabetically. Currently, projects is sorted so project number is not.

b) Being independent if I select say, Tesco as the company, the search box stays on Tesco even when I move to a different record using the navigation buttons or use a different search box, say the project number search box, to move to a different record. How can I refresh the search box when I move record, or use one of the other search boxes?

c) How can I make the cursor jump to a particular field when an item is selected. My problem is that the field I want to jump to changes according to the selection made.

I know this is a heck of an assignment I've set but I'm still learning and this site has been invaluable in sorting out my confusion in the past and is undoubtedly visited by the wisest people in the world. Even half an answer will move me on that bit more.
 
a) Set up queries for each box, with the field required in the query, and sort set to 'Ascending'.

b) You could set code in the after update event of each box to set the other boxes to the appropriate value. Presumably, after you select a record, that record is displayed. Then just set the text boxes to the value in the appropriate text box where that value is displayed.

I.e., if you have search boxes txtSearchCoName, txtSearchProjName and txtSearchProjCode, and display boxes txtCoName, txtProjName and txtProjCode, you would have the display boxes set to the appropriate fields as their ControlSource. When you select, say, a Company Name in txtSearchCoName, you can set the other search boxes to the appropriate display boxes after the record has been displayed.

If you want to use the other search boxes as display boxes, this will not work as you would have to have them bound to fields through their ControlSOurce property. When you wanted to use them as search boxes, anything you typed in would overwrite the field in the current record being viewed.

Personally, when I search in one search box, I just have the other search boxes set to null so that they are not showing invalid data after the record is displayed.

c) Use the SetFocus method in the AfterUpdate event of the search box. Have fun! :eek:)

Alex Middleton
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top