Forms & Subform Fields

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

Using Access 97, I have been given different ideas,
however I seem to be hitting a brick wall.

There is a form and subform:
Form: Paint
Subform: Paint Detail
Subform Control Name: Paint Data

Form: Paint
Form Field: Text12

Subform: Paint Detail
Subform Field: Text13
Control Source Text13: =sum([Y1])

FYI...Form Paint holds basic data about the item which
goes to one table and Subform holds detail data and is on
a separate table.

What is needed is for Text12 = Text13 without using text13
as the control source for text12.
Reason: Text12 needs to fill in a field in a table. The
data text12 will be filling in will be used to sort
records since Access will not allow you to group by
without sorting by that specific field.

Currently using OnGotFocus for text12:
Private Sub Text12_GotFocus()
Dim Y1Total As String
Y1Total = Forms![Paint]![Paint Data].Form![Text13]
Me.Text12 = Y1Total

End Sub

However this means to update the field if changes are made
the user would have to click on the field to see the
changes. Therefore, due to the amount of changes that
management foresees, this is not an option.

I would like to set something up on the subform in
Text13's afterupdate that would automatically change
Text12's value. However, I seem to hit the "Brick Wall"
with the coding. I keep coming up with "can not find
field..... can not find form.... etc"

Can anyone help?

Thank you for any and all help,


Paul
 
I would like to set something up on the subform in
Text13's afterupdate that would automatically change
Text12's value.

I may be overlooking something but you could try the
following code as the last line in Text13's afterupdate:
Call Forms![Paint]![Test12].setfocus
which should shift the focus to Text12 and run it's
GotFocus event.
 
Back
Top