Continuous form

  • Thread starter Thread starter rob
  • Start date Start date
R

rob

In a continuous form I have a row containing 12 textboxes representing
months, let's assume I have 6 rows of data where Product ID is the key.
When you double click on a text box, it opens another form in which the
user can create a "note" about the textbox they clicked on. These notes
get stored to another table, although I can reference the row by including
the Product ID, how can I reference the column (1-12) that they clicked on
in order to store that value to the table ?
 
rob said:
In a continuous form I have a row containing 12 textboxes representing
months, let's assume I have 6 rows of data where Product ID is the key.
When you double click on a text box, it opens another form in which the
user can create a "note" about the textbox they clicked on. These notes
get stored to another table, although I can reference the row by including
the Product ID, how can I reference the column (1-12) that they clicked on
in order to store that value to the table ?

Well, the textbox's event procedures know who they are. The
month 4 text box's double click event can certainly keep
track of the fact that it's the month 4 text box. This info
can then be passed to the notes form using the OpenForm
method's OpenArgs argument.

If you are trying to use one general double click procedure
for all 12 text boxes, then the text box object that was
double clicked is available as
Me.ActiveControl

If you want the name of the control, just retrieve its Name
property. For example, let's say you named the 12 text
boxes Mon1, Mon2, ..., Mon12, then you could get the month
number by using:
CInt(Mid(Me.ActiveControl.Name, 4))

OTOH, if you don't want to do that in the months form, the
notes form can refer back to the months form by using:
CInt(Mid(Forms!monthsform.ActiveControl.Name, 4))
to determine which month text box was double clicked.
 
Back
Top