Mombu the Programming Forum

Go Back   Mombu the Programming Forum > Programming > How To Dim a Variable When Assigning a Recordset to the Variable
User Name
Password
REGISTER NOW! Mark Forums Read




Reply
1 15th September 10:49
tylerbockler
External User
 
Posts: 1
Default How To Dim a Variable When Assigning a Recordset to the Variable



I'm trying to loop through a recordset and add the field name and
field value to a dictionary object.
However, when I turn on Option Explicit, the line marked with an arrow
gives me an "Invalid Use Of Property" error.
I thought I declared rsFIELDS correctly, but apparently not...
Any ideas as to how to correct this?

Thanks!
Tyler


Private Sub cmdRun_Click()
Dim IDFile, DemoFile, errorReturn As String
Dim CnvRegQ As String
Dim ProgBarCount, REGID2003, REGID2004 As Integer
Dim rsFIELDS As ADODB.Recordset

Def2003DSN = txt2003DSN.Text
Def2004DSN = txt2004DSN.Text
intBatch = Val(txtBatch.Text)
ShowName = txtShowName.Text

If Def2003DSN <> "" And Def2004DSN <> "" And intBatch > 0 Then
'SET DSN FOR 2003 DATABASE
Conn2003Str = "DSN=" & Def2003DSN & _
";UID=informix;Password=informix"
'SET DSN FOR 2004 DATABASE
Conn2004Str = "DSN=" & Def2004DSN & _
";UID=informix;Password=informix"

Dim rsCnvReg As New ADODB.Recordset
CnvRegQ = "SELECT * FROM ari.cnv_reg WHERE "& _
" (cnv_id2004 is null or cnv_id2004 = '') "& _
" order by cnv_id2003"
rsCnvReg.Open CnvRegQ, Conn2004Str, 1, 3

Do While Not rsCnvReg.EOF
REGID2003 = rsCnvReg("cnv_id2003")
REGID2004 = GetNextID()

Dim rsReg2003 As New ADODB.Recordset
rsReg2003.Open "SELECT * FROM ari.reg WHERE r_id=" & _
REGID2003, Conn2003Str, 3, 1
If Not rsReg2003.EOF Then
Dim dcReg2003 As New Scripting.Dictionary
dcReg2003.RemoveAll
==========> rsFIELDS = rsReg2003
For Each rsFIELDS In rsReg2003.Fields
dcReg2003.Add rsFIELDS.Name, rsFIELDS.Value
Next
End If
rsReg2003.Close
Set rsFIELDS = Nothing
  Reply With Quote


 


Reply


Thread Tools
Display Modes




666