D
Darryn
Could anyone please tell me wher I am going wrong here with open args
I am trying to pass a ProgramID value from the form frmDetailProgInv
to a popup form and then use the multi selected list values in the
popup form to fill in a subform on frmDetailProgInv.
Here is my code
The open form button on my main form
Private Sub Command17_Click()
On Error GoTo Err_Command17_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmMultiselect"
DoCmd.OpenForm stDocName, , , stLinkCriteria, , acWindowNormal,
"Open Args"
Exit_Command17_Click:
Exit Sub
Err_Command17_Click:
MsgBox Err.Description
Resume Exit_Command17_Click
End Sub
The code to add entries from the popup form to the sub form
Private Sub cmdAddItemsToList_Click()
Dim vItem As Variant, db As DAO.Database
Set db = CurrentDb
For Each vItem In lstSelectItems.ItemsSelected
db.Execute "Insert into tblDetailGearList (ProgramID,
EquipRecordID)"
values (" & lProgramID & ", " & lstSelectItems.ItemData(vItem)&
")", dbFailOnError
Next vItem
End Sub
Private Sub Form_Load()
Dim lProgramID As Variant
lProgramID = Forms!frmDetailProgInv.OpenArgs
End Sub
I am getting a syntax error in this line of the cmdAddItemsToList
event.
values (" & lProgramID & ", " & lstSelectItems.ItemData(vItem)&
")", dbFailOnError
But I cant work out what is worng with my syntax
Darryn
I am trying to pass a ProgramID value from the form frmDetailProgInv
to a popup form and then use the multi selected list values in the
popup form to fill in a subform on frmDetailProgInv.
Here is my code
The open form button on my main form
Private Sub Command17_Click()
On Error GoTo Err_Command17_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmMultiselect"
DoCmd.OpenForm stDocName, , , stLinkCriteria, , acWindowNormal,
"Open Args"
Exit_Command17_Click:
Exit Sub
Err_Command17_Click:
MsgBox Err.Description
Resume Exit_Command17_Click
End Sub
The code to add entries from the popup form to the sub form
Private Sub cmdAddItemsToList_Click()
Dim vItem As Variant, db As DAO.Database
Set db = CurrentDb
For Each vItem In lstSelectItems.ItemsSelected
db.Execute "Insert into tblDetailGearList (ProgramID,
EquipRecordID)"
values (" & lProgramID & ", " & lstSelectItems.ItemData(vItem)&
")", dbFailOnError
Next vItem
End Sub
Private Sub Form_Load()
Dim lProgramID As Variant
lProgramID = Forms!frmDetailProgInv.OpenArgs
End Sub
I am getting a syntax error in this line of the cmdAddItemsToList
event.
values (" & lProgramID & ", " & lstSelectItems.ItemData(vItem)&
")", dbFailOnError
But I cant work out what is worng with my syntax
Darryn