How to search in all tables via VBA

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ahmedtharwat19
    New Member
    • Feb 2007
    • 55

    How to search in all tables via VBA

    Hi EveryOne,

    How can i search a value in all table via vba?
    ex: we have a value caled "ahmed"

    i need to know what field and table name they have a that value.

    (Medo)
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32661

    #2
    This seems a strange question Medo.

    Why would you have this value in different tables? That shouldn't happen in a properly structured database (See Normalisation and Table structures).

    It is possible of course. You would need to use some VBA to do many searches on many tables. The tables are all stored in CurrentDB.Table Defs, and each TableDef has a .Fields collection you can use to cycle through everything.

    Let me repeat though, that this is almost certainly not a good approach and, as certainly, indicates poor database design. I suggest your attention is probably better spent addressing this issue than proceeding on this course.

    Comment

    Working...