Trying to move to a new record. Continuous Form.

Darrenc

Registered User.
Local time
Today, 15:45
Joined
Apr 30, 2004
Messages
62
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.

Code:
With Forms!frmSwictboard!frmIncidentCoreData.Form!frmPartQtyCoreData.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.

Code:
DoCmd.GoToRecord , , acNewRec
Code:
DoCmd.GoToRecord , , acNext
Code:
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.
 
Last edited:
I've fixed it, i've gone SQL Insert Into route.

Just incase anyone is interested the new code is below.

Code:
    With Forms!frmSwictboard!frmIncidentCoreData.Form!frmPartQtyCoreData.Form
        For Each varItem In Me.lstPartValidation.ItemsSelected
        
            DoCmd.SetWarnings False
            DoCmd.RunSQL "INSERT INTO tblCoreData(CoreDataPart,CoreDataQty,CoreDataIncidentID)" & _
                         "VALUES('" & lstPartValidation.Column(0, varItem) & "', '" & lstPartValidation.Column(1, varItem) & "', '" & Forms!frmSwictboard!frmIncidentCoreData.Form!IncidentID.Value & "')"
            DoCmd.SetWarnings True

        Next varItem
    End With
 

Users who are viewing this thread

Back
Top Bottom