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

GoTo a Specific field on a NEW record of the Subform

Status
Not open for further replies.

ZaZa

Technical User
Sep 5, 2001
85
US
HI everyone,

This might be an easy question but I'm way past feeling embarrased so here goes...

I have a Mainform with a Subform called "Comments".

When I change or update the contents of a combobox called "Status" on the MainForm, I want to automatically:

a) to take the user to a new record on the Subform and
b) set the focus onto the field "Reason for change" in the subform.

I have tried the GoToRecords and the Setfocus and combinations of them but no luck yet.

Can any one Help PLease???????

Thanks,
ZaZa
 
Good question.
Easy enough to send the focus to
1) the subform...then
2) the subform's desired element (where search will take place), q.v.,

Forms![MyForm].Form![MySubForm]![txtElement].SetFocus

...and this should set the stage for a "FindFirst" or "FindNext" command...but no luck playing around with the FindNext for a few minutes...
 
On your subform, just set the "Reason For Change" field for the first Tab Stop in your tab order.
 
You may also be able to go to the new record by setting the subform property "Data Entry" to "Yes". But I believe this will take you to the new record every time.
 
Louis, perry

Thanks for responding. I think I just figured it out. I should have told it to :
a) GotoCONTROL called "Comments" on the main form
b) Set focus for the "Reason for Change Field" in the "Comments" subform.

Below I have posted the code for the ONCHANGE event of the "StatusID" field on the MAinForm:

------------------------
Private Sub StatusID_Change()

If Me!StatusID.Value <> Me!StatusID.OldValue Then
MsgBox &quot;Please give your REASONS for changing the status of this Item&quot;
DoCmd.GoToControl &quot;Comments&quot;
Me!Comments![Reason for Change].SetFocus
--------------------------

Now to make it go to the new record, I put the following code on the ENTER event of the &quot;Comments&quot; control ( ie the Subform):

-----------------------------
Private Sub Comments_Enter()

DoCmd.GoToRecord , , acNewRec
------------------------------

This metrod appears to be working (so Far)!!!!!


Thanks for your responses,
ZaZa


IF ANYONE KNOWS OF ANOTHER OR EASIER WAY, PLEASE POST.




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top