I am trying to make the command open a form then add all the values for typeID and OrderDate together. But it is just putting in the answer for one record
Private Sub Command3_Click()
Dim i As Integer
Dim stDocName As String
Dim stlink As String
Dim s As Integer
stDocName = "Form2"
stlink = "[RoadNo]=" & Me![RoadNo]
For s = 1 To 1 'Number of records
For i = 1 To Me.CountOfRoadNo.Value
DoCmd.OpenForm stDocName, , , stlink
Me.TRoDate.Value = Me.TRoDate.OldValue & Forms!form2!TypeID & "," & Forms!form2!OrderDate
DoCmd.GoToRecord , , acNext
Next
DoCmd.Close
DoCmd.GoToRecord , , acNext
Next
End Sub
Private Sub Command3_Click()
Dim i As Integer
Dim stDocName As String
Dim stlink As String
Dim s As Integer
stDocName = "Form2"
stlink = "[RoadNo]=" & Me![RoadNo]
For s = 1 To 1 'Number of records
For i = 1 To Me.CountOfRoadNo.Value
DoCmd.OpenForm stDocName, , , stlink
Me.TRoDate.Value = Me.TRoDate.OldValue & Forms!form2!TypeID & "," & Forms!form2!OrderDate
DoCmd.GoToRecord , , acNext
Next
DoCmd.Close
DoCmd.GoToRecord , , acNext
Next
End Sub