Skip to main content

I'm forced to useIn MS Access 2016 -I am trying to do something very simple.

Populatepopulate a text box on a form, when someone clicks a button on the form.

The button, Command9 - I have set the OnClick event to [Event Procedure], which then created the following:

Private Sub Command9_Click() End Sub 

I added:

Private Sub Command9_Click() Me(Field1) = "hello" End Sub 

I also tried:

Private Sub Command9_Click() Field1.text = "hello" End Sub 

I get the error:

You can't reference a property or method for a control unless the control has the focus 

Can anyone help with this simple problem?

Thank you, Mark

You can't reference a property or method for a control unless the control has the focus

I'm forced to use MS Access 2016 - trying to do something very simple.

Populate a text box on a form, when someone clicks a button on the form.

The button, Command9 - I have set the OnClick event to [Event Procedure], which then created the following:

Private Sub Command9_Click() End Sub 

I added:

Private Sub Command9_Click() Me(Field1) = "hello" End Sub 

I also tried:

Private Sub Command9_Click() Field1.text = "hello" End Sub 

I get the error:

You can't reference a property or method for a control unless the control has the focus 

Can anyone help with this simple problem?

Thank you, Mark

In MS Access 2016 I am trying populate a text box on a form, when someone clicks a button on the form.

The button, Command9 - I have set the OnClick event to [Event Procedure], which then created the following:

Private Sub Command9_Click() End Sub 

I added:

Private Sub Command9_Click() Me(Field1) = "hello" End Sub 

I also tried:

Private Sub Command9_Click() Field1.text = "hello" End Sub 

I get the error:

You can't reference a property or method for a control unless the control has the focus

edited tags
Link
Erik A
  • 32.8k
  • 13
  • 49
  • 75
Source Link
Mark Tait
  • 655
  • 5
  • 16
  • 30

Populate a text box on a button click

I'm forced to use MS Access 2016 - trying to do something very simple.

Populate a text box on a form, when someone clicks a button on the form.

The button, Command9 - I have set the OnClick event to [Event Procedure], which then created the following:

Private Sub Command9_Click() End Sub 

I added:

Private Sub Command9_Click() Me(Field1) = "hello" End Sub 

I also tried:

Private Sub Command9_Click() Field1.text = "hello" End Sub 

I get the error:

You can't reference a property or method for a control unless the control has the focus 

Can anyone help with this simple problem?

Thank you, Mark