Michalis J. said:
From a control in form1 I am opening form2 and copy some values from the
fields of form1 to a subform of form2. After this I would like to move the
cursor to the next record of the subform of form2. Does anybody have an idea
how I can do this.
Thanks in advance.
You're making a common mistake in that you are trying to automate something in
your program by using the same GUI that you would use yourself.
A form is a device that a *human* uses to get data into a table. Your
application itself does not require a form to store data so your code would be
better if it simply put the data directly into the required tables instead of
trying to do the insertions with the second form.
This would be accomplished with insert or update queries (or possibly
RecordSets) and if the user needs to see the result you could open the second
form AFTER the data has been copied.
I agree with the other poster though that copying data is a "warning sign" that
you don't have a proper database design since copying data is rare in a well
designed system.
If there is some reason why you *must* go with your current strategy then
DoCmd.GoToRecord should do the job as it does allow you to specify the form
where the navigation takes place.