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!

Locating a Record on a subform 1

Status
Not open for further replies.

CharlieT302

Instructor
Mar 17, 2005
406
US
Hi All,

I have a combo box on a main form that displays Social Security numbers from a table. The main form contains a subform that displays employee assignments in a tabular format.

I want to select a number from the combo box (main form) and have the subform navigate to the record. I do not want to filter the subform list; only navigate to the record. Both the combobox and subform use the same data source.

I have tried (my syntax is obviously off):

Dim rs object

Set rs = Me.Recordset.clone
Rs.findfirst "Me!Frm_Employee_sub![Soc_Sec] = '" & me![Soc_Search] & "'"

If Not rs.EOF Then Me.Bookmark = rs.Bookmark

Any thoughts?

Thanks
 
can be done in one line.

me.recorset.findfirst "Soc_Sec = '" & me![Soc_Search] & "'
 
Thank you MajP

I really appreciate that simplified approach. However, in this case the "Soc_Sec" field is on a subform, while the combo box is on the parent. I believe I have to modify the syntax to reference that fact. I am not getting the syntax correct.

 
Sorry, did not catch that.

So if calling from the main form combo's after update event

me.NameOfSubformControl.Form.recorset.findfirst "Soc_Sec = '" & me![Soc_Search] & "'
 
Thank you MajP,

That worked great! Just what I was looking for.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top