A.D.TEJPAL
adtp at hotmail.com
Wed May 10 07:23:07 CDT 2006
Mark,
If the form is used independently, sample code in form's module as at (A) below will do the needful. If the form is used as a subform and desired search value is contained in a text box on the parent form, sample code in parent form's module as at (B) below would apply.
MyNumberField & MyTextField are names of pertinent bound controls on the continuous form.
Note - Value of ControlSource is used in VBA statements in order to provide situations where name of bound control is different from its control source.
Best wishes,
A.D.Tejpal
---------------
(A) - Code in module of independent continuous form
(TxtSearch is a text box in header or footer of the form)
=======================================
' For locating number type field
Me.Recordset.FindFirst _
Me.MyNumberField.ControlSource & _
" = " & Me.TxtSearch
' For locating text type field
Me.Recordset.FindFirst _
Me.MyTextField.ControlSource & _
" = '" & Me.TxtSearch & "'"
=======================================
(B) - Code in module of parent form
(TxtSearch is a text box on parent form
SF_SearchSub is the name of control on the parent
form, acting as container for the subform)
=======================================
' For locating number type field on subform
Me.SF_SearchSub.Form.Recordset.FindFirst _
Me.SF_SearchSub("MyNumberField").ControlSource & _
" = " & Me.TxtSearch
' For locating text type field on subform
Me.SF_SearchSub.Form.Recordset.FindFirst _
Me.SF_SearchSub("MyTextField").ControlSource & _
" = '" & Me.TxtSearch & "'"
=======================================
----- Original Message -----
From: Mark A Matte
To: accessd at databaseadvisors.com
Sent: Tuesday, May 09, 2006 21:01
Subject: [AccessD] GoTo a record on form
Hello All,
In A2K I have a form(continuous)...I want to type in text box and have the form goto the first record that matches what I typed...but I don't want to filter...just goto???
Thanks,
Mark A. Matte