G
Guest
All,
I am trying to list the fields in a table as the RowSource for a combo box.
Have referred to both VB Help and to Andi Mayer's post on 1/10/05, but I keep
getting an Error 3420, "Object invalid or no longer set." at the beginning of
the "For Each..." loop. Could use some help figuring out why. Here is the
code:
Private Function VerifyInput() as Boolean
Dim GoodTbl As Boolean
Dim GoodFld As Boolean
Dim tbl As DAO.TableDef ;Have tried both of these
Dim fld As DAO.Field ;with and without the "DAO."
GoodTbl = False
GoodFld = False
If Me![ReIdxTbl] > "" And _
Me![ReIdxTbl] <> "Choose table..." Then
GoodTbl = True
Me.ReIdxFld.RowSource = ""
Set tbl = CurrentDb.TableDefs(Me![ReIdxTbl])
;Text Box [ReIdxTbl] contains a valid table name.
For Each fld In tbl.Fields
;Error is reported after trying to process the line above.
If fld.Type <> dbMemo And _
fld.Type <> dbLongBinary Then
Me.ReIdxFld.RowSource = Me.ReIdxFld.RowSource & ";" & fld.Name
End If
Next fld
Set tbl = Nothing
Set fld = Nothing
Me.ReIdxFld.RowSource = Mid(Me.ReIdxFld.RowSource, 2)
....
Running Access 2002. The database's References include "Microsoft DAO 3.6
Object Library".
Any ideas?
Thanks,
BruceS
I am trying to list the fields in a table as the RowSource for a combo box.
Have referred to both VB Help and to Andi Mayer's post on 1/10/05, but I keep
getting an Error 3420, "Object invalid or no longer set." at the beginning of
the "For Each..." loop. Could use some help figuring out why. Here is the
code:
Private Function VerifyInput() as Boolean
Dim GoodTbl As Boolean
Dim GoodFld As Boolean
Dim tbl As DAO.TableDef ;Have tried both of these
Dim fld As DAO.Field ;with and without the "DAO."
GoodTbl = False
GoodFld = False
If Me![ReIdxTbl] > "" And _
Me![ReIdxTbl] <> "Choose table..." Then
GoodTbl = True
Me.ReIdxFld.RowSource = ""
Set tbl = CurrentDb.TableDefs(Me![ReIdxTbl])
;Text Box [ReIdxTbl] contains a valid table name.
For Each fld In tbl.Fields
;Error is reported after trying to process the line above.
If fld.Type <> dbMemo And _
fld.Type <> dbLongBinary Then
Me.ReIdxFld.RowSource = Me.ReIdxFld.RowSource & ";" & fld.Name
End If
Next fld
Set tbl = Nothing
Set fld = Nothing
Me.ReIdxFld.RowSource = Mid(Me.ReIdxFld.RowSource, 2)
....
Running Access 2002. The database's References include "Microsoft DAO 3.6
Object Library".
Any ideas?
Thanks,
BruceS