Set selected field equal to contents of unbound text box

  • Thread starter Thread starter Teresa via AccessMonster.com
  • Start date Start date
T

Teresa via AccessMonster.com

My table, students has 4 date fields.
I want to be able to select any one of the date fields and put a preset date
in it, as the same date will be used in lots of student records but in
different date fields.

I created a continuous form with an unbound text box in the header to enter
the date I want to use and a button that appears on each record that OnClick
sets the value of the selected field to that of the unbound text box.

If I refer to the field explicitly, i.e. [date1] = NameOfUnboundTextBox, it
works fine but I can't figure out how to do this where [datefield] changes
depending on which is the selected field.
I tried me.activecontrol = NameOfUnboundTextBox but I get "Object doesn't
support this property or method"

Beats me.
 
You're on the right track. The problem with Me.ActiveControl is that when
you click the button, the button is the active control. You have a couple of
options.

1) You could use the double click event of the textbox to insert this date.

2) Instead of Me.ActiveControl, try Screen.PreviousControl.
 
Thanks Wayne. So logical and yet I would never have guessed in a million
years.

The on double click works beautifully and is a better solution than using the
button anyway.

Many thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top