View Full Version : Trying to move to a new record. Continuous Form.


Darrenc
05-14-2007, 02:43 AM
I know there are many topics on this subject, and believe me i've looked at most. It should be a really simple thing to do, and i'm frustrated i've spent so much time without a solution.

With a bit of luck someone can point out the obvious for me.


With Forms!frmSwictboard!frmIncidentCoreData.Form!frmPa rtQtyCoreData.Form
For Each varItem In Me.lstPartValidation.ItemsSelected

!CoreDataPart.Value = Me.lstPartValidation.Column(0, varItem)
!CoreDataQty.Value = Me.lstPartValidation.Column(1, varItem)
DoCmd.GoToRecord , , acNewRec
'.Requery

Next varItem
End With


I have an unbound list box, and i'm trying to populate the selected items into my Sub-Form.
When i select more than one item in the list box, the first item goes in ok, but then is overwritten by the second item.

I've tried different methods of starting a new record, and without success. This is what i've tried so far.

DoCmd.GoToRecord , , acNewRec
DoCmd.GoToRecord , , acNext
DoCmd.RunCommand acCmdRecordsGoToNew

I've tried requerying/refreshing between items, i know i'm missing the obvious, can someone put me out of my misery please :o


Thanks

Darren.

Darrenc
05-14-2007, 05:47 AM
I've fixed it, i've gone SQL Insert Into route.

Just incase anyone is interested the new code is below.

With Forms!frmSwictboard!frmIncidentCoreData.Form!frmPa rtQtyCoreData.Form
For Each varItem In Me.lstPartValidation.ItemsSelected

DoCmd.SetWarnings False
DoCmd.RunSQL "INSERT INTO tblCoreData(CoreDataPart,CoreDataQty,CoreDataIncid entID)" & _
"VALUES('" & lstPartValidation.Column(0, varItem) & "', '" & lstPartValidation.Column(1, varItem) & "', '" & Forms!frmSwictboard!frmIncidentCoreData.Form!Incid entID.Value & "')"
DoCmd.SetWarnings True

Next varItem
End With