A button on my form adds a new record onto my subform. Once the new record is added, I'd like to SetFocus onto a specific field on that subform.
Code:
Private Sub btnAddIngredientRec_Click()
Dim RecNum As Integer
RecNum = Me.CurrentRecord
AddIng (RecNum)
Forms!frmRecipes.SetFocus
Me.Refresh
' Here is where I'd like to execute some sort of SetFocus code
End Sub
Private Sub AddIng(RecNum As Integer)
DoCmd.OpenForm "frmIngredients"
Forms!frmIngredients.AllowAdditions = True
DoCmd.GoToRecord , , acNewRec
' Link to tbl1Recipe
Forms!frmIngredients!txtRecipeID = RecNum
' Set to Dummy Value
Forms!frmIngredients!cmbIngredientName = 100
Forms!frmIngredients.AllowAdditions = False
DoCmd.Close
End Sub
Also, for my own clarification, what's the difference between ! and . when accessing different controls?