setting textbox value in subform from main form

  • Thread starter Thread starter taikin
  • Start date Start date
T

taikin

Guest
hi, the title says it, i can't seem to set the textbox value in subform from main form as error pops up saying there is no focus on it but when i tried to set focus on the textbox before setting the the text, access says it can't set focus on the object.

Code:
Me!subfCoach!cmbStatus.SetFocus
Me!subfCoach!cmbStatus.SelText = "Inactive"
 
taikin said:
hi, the title says it, i can't seem to set the textbox value in subform from main form as error pops up saying there is no focus on it but when i tried to set focus on the textbox before setting the the text, access says it can't set focus on the object.

Code:
Me!subfCoach!cmbStatus.SetFocus
Me!subfCoach!cmbStatus.SelText = "Inactive"


Hi, I cant remember the syntax exactly.

Google it, by typing Access VBA sub form reference
 
The .SelText method returns to you the text that was selected. It doesn't set the value of the text box.

To do that, something like:
Me!subformName.Form!ControlName= "Inactive"

Read Mile's FAQ: Syntax for Main and Subforms
 

Users who are viewing this thread

Back
Top Bottom