Opening a subform on new record

M

Moe

On my "Payments" form I have a subform named "Payment Subform" The main form
opens the existing orders and the subform records payments for those orders.
Each order may have multiple payments therefore, the subform can always be
opened to take a new payment. I used the "RunCommand acCmdRecordsGoToNew" on
the subform "on Load event" to make it to open blank but every time I try to
open the form first it gives me a runtime error "the command RecordsGoToNew'
isn't available now" then if I close the error window the form opens normally
and function the way expected.
 
D

Damian S

Hi Moe,

Instead of using the on load event of your subform to move to a new record,
use the On Current event of your main form to jump to your subform, make your
subform move to a new record then jump back to your main form - seems messy,
but there doesn't seem to be much in the way of support for subforms with the
docmd.gotorecord... see the following article:
http://support.microsoft.com/kb/92685

Here's your code eg:
me.SUBFORMNAME.form.CONTROLNAME.setfocus
docmd.gotorecord ,, acNew
forms!MAINFORM.CONTROLNAME.setfocus

Damian.
 
M

Moe

Thanks Damian
But it did not work. "Me.SUBFORMNAME.Form.CONTROLNAME.SetFocus" causes a
runtime error of "Object dosn't support this property or method" or"This is
an invalid methos or expression" I even tried to set focus on the subform
first and then set the focus on its control but that did not work either.
 

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