Sub Form activation

G

Guest

Im my Accounting system I have a cheque payment Form with a SubForm which
nominates the Bank Ledger No., by default, upon which the cheque is drawn.

This works fine - IF - I force the user to click on a field within that
SubForm.

There is however no need for the user to click on any field within the
SubForm, as it is all default data (only 1 Bank account) - BUT - if the user
does not click on any field within the SubFrm - the record is not saved when
the form is closed.

How can I SAVE the record of the SubFrm without having to click on a field
within that SubFrm?
 
A

Arvin Meyer [MVP]

Setting the default values for a record does not create a record. You need
to add something and save it to create the record.

So the trick is to force the value, rather than allow the default (aircode):

Sub Form_AfterUpdate()
If Me.NewRecord = True Then
Me.subFormControlName.Form![Bank Ledger No.] = 123456789
Me.subFormControlName.Form.Dirty = False
End If
End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads
http://www.datastrat.com
http://www.mvps.org/access
 

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