Display Name of Field from 1 form in an unbound box on another for

D

DM - NPS

I have 2 forms, 1 that is used to enter data and 1 that is a giant number
pad. If a person double clicks in one of the fields on the data entry form
it will open the number pad form and they can use the number pad to enter the
data. This process works great.

However, I want to have an unbound box at the top of the number pad form
that shows which field has the focus on the data entry form. Any ideas?

Thanks in advance.
 
J

Jeanette Cunningham

Easy.

Get the name of the field when the user clicks the control.
If the control name is the same as the field name, that's easy.
Otherwise you can store the field name in the control's tag.

Pass the name of the field as OpenArgs to the code that opens the number pad
form.
In the Open event of the number pad form, you get the field name from the
openargs and use it to set the value for the unbound textbox.

In the double click event:
DoCmd.OpenForm "frmNumberPad", , , , , , Me.ActiveControl.Name

Or

DoCmd.OpenForm "frmNumberPad", , , , , , Me.ActiveControl.Tag



In the Open event of the number pad form:
If Not IsNull(Me.OpenArgs) Then
Me.NameOfUnboundtextBox = Me.OpenArgs
End If


Note: replace my object names with your own.

Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

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

Top