Use of multi recordsets

A

Amduke

Hello,
I'm trying to update table1 with available data out of table 2. There is one
very important issue: in table 2, it can be so that the refering fields are
not always filled with data. I want to find records in table 2 base on
variables filled with information out of table 1. Lets say I have filled 3
variables, but I can't be shure that there is an equivalent in table 2. It
can be so that there just one field that has a match.
This will be checked with an extra loop.
The problem that I'm encounter: How can I search through table 2?
Find hereafter the code I've already written

Private Sub AddFormType()

Set cnn = CurrentProject.Connection
Dim rs_FrmTypPar As New ADODB.Recordset
Dim rs_BO As New ADODB.Recordset
rs_FrmTypPar.activeconnection = cnn
rs_BO.activeconnection = cnn

Dim SqlFrmTypPar As String
Dim SqlBO As String
Dim m_datum As String
Dim m_pf, m_ProdFam As String
Dim m_pgvss, m_PG, m_VSS As String
Dim m_ntpgvss As String
Dim m_RepType As String
Dim m_typupdate As Boolean

'Opening the tables (Recordsets)
'Table 1
SqlBO = "Tbl_BackOrders"
rs_BO.Open SqlBO, cnn, adOpenStatic, adLockOptimistic
'Table 2
SqlFrmTypPar = "Tbl_FormTypeParam"
rs_FrmTypPar.Open SqlFrmTypPar, cnn, adOpenStatic, adLockOptimistic
'Check: which table is active wright now ?
Debug.Print "Open table:" & Application.CurrentObjectName

'Positioning at the top of the table
rs_BO.MoveFirst
'Loop through all the records
Do Until rs_BO.EOF
'Fill up some variables
m_ProdFam = rs_BO.Fields("ProdFam")
m_PG = rs_BO.Fields("PG")
m_VSS = rs_BO.Fields("VSS")

'Find the value in the parametertable containing the report type
description
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top