Cursor possition

M

Michalis J.

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.
 
L

Larry Daugherty

Sure and I'll be happy to do so when you post back with the complete
list of the relational rules proposed by E.F. Codd and C.J. Date of
IBM circa 1970 and prove that doing so wouldn't compromise any of
those rules.

HTH
 
R

Rick Brandt

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.
 
M

Michalis J.

Thank you for your responce Rick.
Let me tell you that form1 ia an appointment form used at the counter of a
hair saloon which contains apointments for every 30min for every employee.
When a customer checks out, the person at the counter doubleclics his name of
the customer on the appointment form and this opens the invoice form (form2)
which contains all the information regarding the customer and the service he
received together with the apropriate prices. Here is some code of the
subform of employee1 of form1:
Private Sub Ctl1000NAME_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "INVMAINF"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Forms!INVMAINF!CUSTOMER = Me.[1000NAME]
Forms!INVMAINF!DATE = Me.DATE
Forms!INVMAINF!INVSUBF!EMPLOYEE = Me.Text361
Forms!INVMAINF!INVSUBF!WORK = [1000WORK]
Forms!INVMAINF!INVSUBF!PRICE = DLookup("PRICE ", "WORKTYPE ", "WORKTYPE= '"
& [1000WORK] & "'")
Forms!INVMAINF!INVSUBF!CUSTOMER = Forms!INVMAINF!CUSTOMER
Forms!INVMAINF!INVSUBF!DATE = Forms!INVMAINF!DATE
C100 = -1
Me.[1000NAME].BackColor = 16711935
Me.[1000WORK].BackColor = 16711935

At this point however I want to be able to add a second service on the
invoice form by doubleclicking a second service again from the appointment
form. To do this I need the cursor to be moved to the next record of the
subform of the invoice form. This ofcource can be done by using the mouse but
I would prefer to do it automatically.
I hope all this is not confusing but I thought I sould try to give you more
details to understand the logic.
 
Top