Hi,
I have sfrmInvoice that is contained in frmInvoice. It is a continuous form. sfrmInvoice is updated from a popup. This is all working fine. I'm would like the focus to be set to [recipeItemName] which is the first textbox in he new record. I've tried doing to this on various events but nothing seems to work. As a result, the user has to click on the cell that that the new info should be placed in. What event would I use to set the foucs to [RecipeItemName] in the new record?
Thanks,
Leesha
Set focus to New Record
-
- Administrator
- Posts: 78235
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Set focus to New Record
Perhaps
Code: Select all
Private Sub Form_Current()
If Me.NewRecord Then
Me.RecipeItemName.SetFocus
End If
End Sub
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1484
- Joined: 05 Feb 2010, 22:25
Re: Set focus to New Record
I got an error that says ambiguous name detected and points to Form_Current.
-
- Administrator
- Posts: 78235
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Set focus to New Record
You an have only one Form_Current event procedure for a form. Copy the lines
into the other Form_Current procedure (the one you already had), and then delete the entire new Form_Current procedure (the one from my previous reply).
Code: Select all
If Me.NewRecord Then
Me.RecipeItemName.SetFocus
End If
Best wishes,
Hans
Hans
-
- BronzeLounger
- Posts: 1484
- Joined: 05 Feb 2010, 22:25
Re: Set focus to New Record
That took care of the error, however it doesn't move the focus to RecipeItemName in the new row. The new row shows but the record selector remains on the previous row where the data was entered from the popup form.
-
- Administrator
- Posts: 78235
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands