G
Guest
I have a subform within a form. After a number is
selected in the main form, the subform is populated with
records for whatever number was selected, so if 4 is
selected 4 records appear in the subform. Everything
works fine until I leave the form. After I leave the
form, the main form is then populated for the amount of
whatever number was selected, so when I go back to the
form, now there are also 4 of the same main forms. Here
is the function I put in to populate the main form, but
I'm not sure if that is it or not. The primary key of the
main form is a date/time field and it is related to the
subform by a date field. I need a fresh set of eyes to
look at this, thanks for any help:
Private Sub cmdPopulateSubForm_Click()
Dim iNumber As Integer
Dim iIndex As Integer
iNumber = lstCameraCount
iIndex = 1
Forms!frmDigitalVideo!frmSubcontrol.SetFocus
Do
'go to new record
frmSubcontrol!CamerasAvailable.value = iIndex
frmSubcontrol!ServiceNeeded.value = 10
frmSubcontrol!CameraType.value = 10
iIndex = iIndex + 1
DoCmd.GoToRecord , , acNewRec
Loop While iIndex <= lstCameraCount
end function
The values are drop down box values for the default for
the field.
selected in the main form, the subform is populated with
records for whatever number was selected, so if 4 is
selected 4 records appear in the subform. Everything
works fine until I leave the form. After I leave the
form, the main form is then populated for the amount of
whatever number was selected, so when I go back to the
form, now there are also 4 of the same main forms. Here
is the function I put in to populate the main form, but
I'm not sure if that is it or not. The primary key of the
main form is a date/time field and it is related to the
subform by a date field. I need a fresh set of eyes to
look at this, thanks for any help:
Private Sub cmdPopulateSubForm_Click()
Dim iNumber As Integer
Dim iIndex As Integer
iNumber = lstCameraCount
iIndex = 1
Forms!frmDigitalVideo!frmSubcontrol.SetFocus
Do
'go to new record
frmSubcontrol!CamerasAvailable.value = iIndex
frmSubcontrol!ServiceNeeded.value = 10
frmSubcontrol!CameraType.value = 10
iIndex = iIndex + 1
DoCmd.GoToRecord , , acNewRec
Loop While iIndex <= lstCameraCount
end function
The values are drop down box values for the default for
the field.