2 small Questions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do you put more than one code in an event
Ie.
on current
=LockBoundControls([Form],True)
=AutoFillNewRecord(Forms!OrdersWDetails)

----------
2nd question:

How do I update the parent (Orders) lastedited field when I save the changes
in the child OrderDetails.

me.lastedited = Now

works for the Orders but not for the child...

Thanks!
 
Answer 1:
You create an event procedure for your event and call the functions from
there:

Private Sub Form_Current()
Call LockBoundControls( Me, True )
Call AutoFillNewRecord( Forms!OrdersWDetails )
End Sub

Answer 2:
Assuming OrderDetails is bound to a subform on your Orders form:

Me.Parent!LastEdited = Now

The Parent property of a subform is a reference to the form which contains
that subform.
 
How do you put more than one code in an event
Ie.
on current
=LockBoundControls([Form],True)
=AutoFillNewRecord(Forms!OrdersWDetails)

The event should show [Event Procedure], and you should edit the VBA
code to

Private Sub <whatever the event name might be>()
Call LockBoundControls(Me, True)
Call AutoFillNewRecord(Forms!OrderWDetails)
End Sub
----------
2nd question:

How do I update the parent (Orders) lastedited field when I save the changes
in the child OrderDetails.

me.lastedited = Now

works for the Orders but not for the child...

Use the AfterUpdate event on the subform and use

Parent!lastedited = Now

John W. Vinson[MVP]
 
THANKS A BUNCH!

John Vinson said:
How do you put more than one code in an event
Ie.
on current
=LockBoundControls([Form],True)
=AutoFillNewRecord(Forms!OrdersWDetails)

The event should show [Event Procedure], and you should edit the VBA
code to

Private Sub <whatever the event name might be>()
Call LockBoundControls(Me, True)
Call AutoFillNewRecord(Forms!OrderWDetails)
End Sub
----------
2nd question:

How do I update the parent (Orders) lastedited field when I save the changes
in the child OrderDetails.

me.lastedited = Now

works for the Orders but not for the child...

Use the AfterUpdate event on the subform and use

Parent!lastedited = Now

John W. Vinson[MVP]
 

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