I have two identical forms (design). One populates a recordset (substances) into a listview, the other populates another recordset (workstations) into a listview. But both of these forms are identical design wise. I want to have just one form to display both recordsets, by means of a flag on form show or load (i'm not sure how). In the form is a sub PopulateListview:



Public Sub PopulateListview(loadRecordset As Integer)

Dim SQL As String
Dim lsiListItem As ListItem
Dim rs As ADODB.Recordset


Set rs = New ADODB.Recordset

Select Case loadRecordset

Case 0


SQL = "SELECT SubstanceAssess.SubstanceAssessID, SubstanceAssess.CoshhRef, SubstanceAssess.SubstanceName, User.Description FROM [User] INNER JOIN SubstanceAssess ON User.UserID = SubstanceAssess.UserID WHERE (((SubstanceAssess.Archived)=-1))"


Case 1


SQL = "SELECT WorkstationAssessID, WorkstationName, Location, User.Description FROM [User] INNER JOIN WorkstationAssess ON User.UserID = WorkstationAssess.UserID WHERE expired=True order by WorkstationName"


End Select



lsvListView.ListItems.Clear

With rs
.Open SQL, conn, adOpenKeyset, adLockOptimistic
If .RecordCount = 0 Then Exit Sub

Do Until .EOF
Set lsiListItem = lsvListView.ListItems.Add(, , rs(0))
lsiListItem.SubItems(1) = rs(1)
lsiListItem.SubItems(2) = rs(2)
lsiListItem.SubItems(3) = rs(3)
.MoveNext
Loop
.Close
End With

lsvListView.SelectedItem = Nothing

Set rs = Nothing

End Sub

This sub works when I set loadRecorset in form load. However the form will be loaded from a MDI form. So I need to pass loadRecordset to the form from the MDI. How? The only parameters when loading a form is modal?

Thanks.

Daz