G
Guest
i am creating a recordset in code that I want to dump into a table so I can
pull from it in a query. is this possible? how?
here is the code i have to create the recordset...
Set qd = con.CreateQueryDef("", sql8)
Set rs = qd.OpenRecordset
With rs
I = 1
'Dim PlantInfo(30, 6) As Variant
Dim OutageType(1000, 30)
Dim StartDate(1000, 30)
Dim EndDate(1000, 30)
Dim MWBefore(1000, 30)
Dim MWAfter(1000, 30)
Dim NERCID(1000, 30)
Dim CAUSECODE(1000, 30)
Dim COMPID(1000, 30)
Dim OUTAGENUMBER(1000, 30)
Dim Extreme(30, 2) As Date ' 1 is the start,
Dim kay(30) As Integer
For aka = 1 To Numplants
kay(aka) = 0
Next aka
Do While Not .EOF
j = 1
pick = "maybe"
Do While pick = "maybe"
If (!NERC_UNIT_ID) = PlantInfo(j, 2) Then
pick = "yes"
plantdex = j
End If
If j > Numplants Then
pick = "no"
End If
j = j + 1
Loop
If pick = "yes" Then
kay(plantdex) = kay(plantdex) + 1
OutageType(kay(plantdex), plantdex) = (!OUTAGE_TYPE)
StartDate(kay(plantdex), plantdex) = (!START_DATE)
EndDate(kay(plantdex), plantdex) = (!END_DATE)
MWBefore(kay(plantdex), plantdex) = (!MW_BEFORE_RED)
MWAfter(kay(plantdex), plantdex) = (!MW_REDUCTION)
NERCID(kay(plantdex), plantdex) = (!NERC_UNIT_ID)
OUTAGENUMBER(kay(plantdex), plantdex) = (!OUTAGE_NUMBER)
End If
I = I + 1
.MoveNext
Loop
End With
pull from it in a query. is this possible? how?
here is the code i have to create the recordset...
Set qd = con.CreateQueryDef("", sql8)
Set rs = qd.OpenRecordset
With rs
I = 1
'Dim PlantInfo(30, 6) As Variant
Dim OutageType(1000, 30)
Dim StartDate(1000, 30)
Dim EndDate(1000, 30)
Dim MWBefore(1000, 30)
Dim MWAfter(1000, 30)
Dim NERCID(1000, 30)
Dim CAUSECODE(1000, 30)
Dim COMPID(1000, 30)
Dim OUTAGENUMBER(1000, 30)
Dim Extreme(30, 2) As Date ' 1 is the start,
Dim kay(30) As Integer
For aka = 1 To Numplants
kay(aka) = 0
Next aka
Do While Not .EOF
j = 1
pick = "maybe"
Do While pick = "maybe"
If (!NERC_UNIT_ID) = PlantInfo(j, 2) Then
pick = "yes"
plantdex = j
End If
If j > Numplants Then
pick = "no"
End If
j = j + 1
Loop
If pick = "yes" Then
kay(plantdex) = kay(plantdex) + 1
OutageType(kay(plantdex), plantdex) = (!OUTAGE_TYPE)
StartDate(kay(plantdex), plantdex) = (!START_DATE)
EndDate(kay(plantdex), plantdex) = (!END_DATE)
MWBefore(kay(plantdex), plantdex) = (!MW_BEFORE_RED)
MWAfter(kay(plantdex), plantdex) = (!MW_REDUCTION)
NERCID(kay(plantdex), plantdex) = (!NERC_UNIT_ID)
OUTAGENUMBER(kay(plantdex), plantdex) = (!OUTAGE_NUMBER)
End If
I = I + 1
.MoveNext
Loop
End With