Note that the code is for open, which in this context is the name of the
control bound to the [Open] field. The field and the text box should have
different names so that both you and Access are less likely to be
confused. If the field is named [Open], try something like txtOpen as the
text box name. Another point is that Open is a reserved word in Jet (the
database engine underlying the user interface of the Access programs you
create). The use of reserved words for field and control names should be
avoided. However, if they are used they should be in square brackets. If
you use txtOpen as the name of the text box bound to the [Open] field,
then the After Update event for the *text box* would look something like
this:
Private Sub txtOpen_AfterUpdate()
If Me.[Open] > 0 Then
Me.SubFormName.SetFocus
Forms!BillsOpenValue!PaidBillsHelp.Form![txtOpen] = -1
End If
End Sub
The code should work in the form's After Update event as well, and several
other places such as the subform control's Enter event. Note that when
referencing a control (or property) on the active form, you don't need to
use the Forms!etc. syntax. That is to say, your main form's record source
includes the field Open, and txtOpen is on the main form, so you can use
the Me.txtOpen syntax. The long syntax should work, but it is not
necessary. The subform is a separate object, so you need the longer syntax
when referencing it from another form (the main form).
Amateur said:
Dear Wayne I've tried your code in the afterUpdate in in the sub-form as
well
as in the main form.
Both trials are not bringing any result. I have the following code
If (Forms!billsopenvalue!open >0) Then
Me.paidbillshelp.SetFocus
Forms!billsopenvalue!paidbillshelp.Form!open = -1
End If
Do you have another solution?
Klaus