I have a function which runs an SQL query and returns a recordset. This function takes two recordsets as arguments for the SQL statement.
So far I have this:
Private Function Additions(existingData As ADODB.Recordset, additionalData As ADODB.Recordset) As ADODB.Recordset
Dim adoRs As ADODB.Recordset
Dim SQL As String
Set adoRs = New ADODB.Recordset
SQL = "SELECT Additional.*, Existing.* FROM Additional, Existing;"
adoRs.Open SQL
adoRs.Sort = "PartNo"
Set Additions = adoRs
Set adoRs = Nothing
End Function
Clearly this is incorrect; the problem I am having is having is how do you change this code so that the SQL terms additional and existing refer to the two recordsets passed into the function? What I am trying to do is to run the query on the two recordsets passed into the function as if they were tables.
If this will never work then what is the best alternative to approach this?
Any help is greatly appreciated.
Thanks
All help is greatly appreciated
Kind regards
Ota
So far I have this:
Private Function Additions(existingData As ADODB.Recordset, additionalData As ADODB.Recordset) As ADODB.Recordset
Dim adoRs As ADODB.Recordset
Dim SQL As String
Set adoRs = New ADODB.Recordset
SQL = "SELECT Additional.*, Existing.* FROM Additional, Existing;"
adoRs.Open SQL
adoRs.Sort = "PartNo"
Set Additions = adoRs
Set adoRs = Nothing
End Function
Clearly this is incorrect; the problem I am having is having is how do you change this code so that the SQL terms additional and existing refer to the two recordsets passed into the function? What I am trying to do is to run the query on the two recordsets passed into the function as if they were tables.
If this will never work then what is the best alternative to approach this?
Any help is greatly appreciated.
Thanks
All help is greatly appreciated
Kind regards
Ota