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

Find Record Error 1

Status
Not open for further replies.

ITProg

Programmer
Nov 9, 2004
43
US
I have a form with a form header section that contains a combo box and a text box. The form also has a detail section that has a tab control that contains the rest of the data entry boxes. I put a Find Record button in the detail section of my form. When I try to Find Record using the combobox or textbox values in the form header, I get an error saying it cant search the tab control, use the Gotocontrol action before the Find Record Action, change current field action from yes to no, or change the focus to a searchable control. If I search items in the detail section I do not get errors. The code created by the Find Record button is below. I'm not sure how to get it to set focus to the appropriate box in the form header section if that is the field I am searching on.

Private Sub cmdFind_Click()
On Error GoTo Err_cmdFind_Click


Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_cmdFind_Click:
Exit Sub

Err_cmdFind_Click:
MsgBox Err.Description
Resume Exit_cmdFind_Click
 
It sounds like you have to activate the tab control before you can search it for the record you are looking for. I am not sure though, your post is a little unclear as to what is what. Is the tab control fields connected to the data source of the form or are there subforms involved. If it is connected to the data source you might want to try book marking or filtering instead of the Find Record.

Just a thought.

Hope this helps.

OnTheFly
 
The tab control fields are connected to the datasource of the form. I do not have any subforms. I can search data in the tab control fields, but not the data in fields above the tab control.
 
OK, I am confused. I thought the probelm was you could not search the Tab Control? What are the fields above the Tab Control bound to? Are the bound to the same data source as the Tab Control? Are they also in the Detail Section of the form?

Sorry I am not being much help, I am just having a little trouble understanding what exactly you are trying to do.
 
All fields on the form are bound to the same datasource. I have 2 fields (id#, name) at the top of the form in the form header section. The tab control is in the detail section. The find record button is in the detail section on the first page of the tab control. I get errors when I try to search the fields in the form header section. I would like to be able to search fields in either the form header or detail section. Sorry if this is confusing.
 
If the 2 fields (id#, name) are bound fields then I am pretty sure that having them in the header of the form is what is causing the problem. Generally the header of the form would be used to group things together that appear in the detail section. Or to put unbound controls, Form labels and command buttons to process the information in the details section or to do summary information.

If the id# and the name are parts of each record you should move your tab control down and put these field in the detail section of the form. Then you should not have a problem with your find.

If you are trying to do a grouping thing where the ID# is not unique then instead of doing a find you might try applying a filter to the form instead.

Hope this helps.

OnTheFly
 
I not only had to move the fields to the detail section, I also had to move the find button off the tab control to another section of the form. Now it works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top