A sub form is not opened on it's own, so that is not going to work for you.
What event of the subform is the code in?
You might try this in the Load event of the main form:
DoCmd.GoToRecord acDataForm, "[" & Me.SubformName.Form.Name & "]", acNewRec
--
Dave Hargis, Microsoft Access MVP
:
Please post the code that is not working. Subforms have to be referenced
differently as they are not open on their own.
--
Dave Hargis, Microsoft Access MVP
:
Use the GotoRecord method. It is explained in VBA Help. If you are using a
macro, then it is the GotoRecord action, also in VBA Help.
--
Dave Hargis, Microsoft Access MVP
:
What is the code to go to the last row where is added a new record
when you type something?
I tryed adding a record to the form recordset but I don't want to
leave that record empty, I just want it to be ready to load data into.
Greetings from Paraguay.
Claudio Bogado Pompa.- Ocultar texto de la cita -
- Mostrar texto de la cita -
GoToRecord works fine when I am working on a form, but when I try to
use a subform I get the "Form is not opened" error.
How do I solve it?
Greetings from Paraguay.
Claudio Bogado Pompa.- Ocultar texto de la cita -
- Mostrar texto de la cita -
The code is part of the subform.
DoCmd.GoToRecord acDataForm, "[" & Me.Name & "]", acNewRec- Ocultar texto de la cita -
- Mostrar texto de la cita -