TableDef

nvus

Registered User.
Local time
Today, 08:25
Joined
May 11, 2007
Messages
14
Good Morning,

I need to run a process with certain fields from a specific table. I thought the best approach was to create a collection using tableDefs and am way out of my league here but giving it a shot anyway.

The only fields I need to run this process on within the table are the fields that have "HEX" in it's description. There are 13 of them. I'm going to apply this collection to an array statement.

I have the following code:
Code:
Public Sub DefHex()
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Dim FLD As DAO.Field
Dim fldSearch As String
Dim v As Variant

Set dbs = CurrentDb
Set tdf = dbs.TableDefs("tPDE")

fldSearch = "Hex"

For Each FLD.Properties("Description") In tdf.Fields
    If FLD.Properties("Description") = fldSearch Then
        v = 1
    End If
Next

Debug.Print v
End Sub
However, when I attempt to run it, I recieve the following error:
Variable required-Can't assign to this expression
Again, I know I'm way out of my league here, but feel I've very close. If someone could shed some light (in simple terms), I would certainly appreciate it.

As for the array, I have most of the code.

Thanks in advance.
 
You don't say whether the only thing in the description is the term "HEX" or whether that word appears in a longer context.

If the latter, consider using InStr() to find "HEX" in the description rather than having your code search for a description that exactly equals HEX.

Also, typically when you get an error in VBA code, if the debugger is enabled it should highlight some line of code. Does it? If so, which one?
 
Thanks for the response. The only thing in there is "HEX", I'm sorta using similar to using the TAG property of a control.

As for the error msg, it is as I stated in my original post but unlike normally, it doesn't take me to code where the error is hightlighted.

Again thanks for the response.
 

Users who are viewing this thread

Back
Top Bottom