I need to use a variable to set the focus on one of a dozen fields.
I have a user input form with a textbox (txtField) on it where the number of the field (the field names are all numbers) is entered. The code behind the after update event of txtField is:
Dim intField as Integer
Dim strFieldName as Control
intField = me.txtField
strFieldName = "forms!frmEntry![" & intfield & "]"
strFieldName.SetFocus
When I run this, I get error 91: object variable or with block variable not set.
When I put Set in front of the line setting the value of strFieldName, I get type mismatch
When I change the intField to Variant instead of Integer, I get Runtime error 424, Object required.
Anybody know what I need to do to make this work?
I have a user input form with a textbox (txtField) on it where the number of the field (the field names are all numbers) is entered. The code behind the after update event of txtField is:
Dim intField as Integer
Dim strFieldName as Control
intField = me.txtField
strFieldName = "forms!frmEntry![" & intfield & "]"
strFieldName.SetFocus
When I run this, I get error 91: object variable or with block variable not set.
When I put Set in front of the line setting the value of strFieldName, I get type mismatch
When I change the intField to Variant instead of Integer, I get Runtime error 424, Object required.
Anybody know what I need to do to make this work?