Hi all,
I'm a bit stumped on a problem - I have an access routine that works through a list box and opens up a form for each entry to update the record.
Trouble is that once the form has been opened and edited, the list box then resets, so I can only update one at a time - here's the code:
Private Sub cmdSendMani_Click()
On Error GoTo cmdSendMani_Click_Err
Dim stConNum As String
Dim varItem As Variant
Dim stWhere As String
For Each varItem In Me.lstSendMani.ItemsSelected
stConNum = Me.lstSendMani.Column(1, varItem)
DoCmd.OpenForm "frmShipList", acNormal, , stWhere, acFormEdit, acHidden
If Forms![frmShipList]![luStatus] = 1 Then
Forms![frmShipList]![luStatus] = 2
End If
Forms![frmShipList]![ManiSent] = -1
DoCmd.Close acForm, "frmShipList", acSaveYes
Next
Me.lstSendMani.Requery
cmdSendMani_Click_Exit:
Exit Sub
cmdSendMani_Click_Err:
MsgBox Error$
DoCmd.Close acForm, "frmPrint"
Resume cmdSendMani_Click_Exit
End Sub
Is there an alternative to opening a form and changing the data - maybe opening the recordset instead?
Any help apprieciated as always
I'm a bit stumped on a problem - I have an access routine that works through a list box and opens up a form for each entry to update the record.
Trouble is that once the form has been opened and edited, the list box then resets, so I can only update one at a time - here's the code:
Private Sub cmdSendMani_Click()
On Error GoTo cmdSendMani_Click_Err
Dim stConNum As String
Dim varItem As Variant
Dim stWhere As String
For Each varItem In Me.lstSendMani.ItemsSelected
stConNum = Me.lstSendMani.Column(1, varItem)
DoCmd.OpenForm "frmShipList", acNormal, , stWhere, acFormEdit, acHidden
If Forms![frmShipList]![luStatus] = 1 Then
Forms![frmShipList]![luStatus] = 2
End If
Forms![frmShipList]![ManiSent] = -1
DoCmd.Close acForm, "frmShipList", acSaveYes
Next
Me.lstSendMani.Requery
cmdSendMani_Click_Exit:
Exit Sub
cmdSendMani_Click_Err:
MsgBox Error$
DoCmd.Close acForm, "frmPrint"
Resume cmdSendMani_Click_Exit
End Sub
Is there an alternative to opening a form and changing the data - maybe opening the recordset instead?
Any help apprieciated as always