I have a ListView object within my Microsoft Access database that is set to Report View. When a user selects a row from this list, I want to be able to open a secondary form and populate based on the selected values. I am running into trouble with the proper syntax for capturing the column values I need. I have searched high and low looking for information on this, however I have not been able to find anything that fits my particular criteria.
Here is the code in question:
Private Sub ListView1_ItemClick(ByVal Item As Object)
Dim FormID, FilingID, RowIndex As Integer
Dim FilingName As String
RowIndex = Item.Index
FormID = Item.SubItems(0)
FilingID = Item.SubItems(1)
FilingName = Item.SubItems(2)
If MsgBox("Do you want to open up filing " & FilingName & "?", vbYesNo, "Confirmation") = vbYes Then
DoCmd.OpenForm "frmFiling", acNormal, , , , , "FormID=" & FormID & ";FilingID=" & FilingID
This code keeps throwing an exception on the line FormID = Item.SubItems(0) stating that it is an invalid property value.
Does anybody know what I am doing wrong here, or have a workaround that accomplishes what I am trying to do?