Results 1 to 7 of 7

Thread: How to display field types of access tables in vba?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Arrow How to display field types of access tables in vba?

    can any one show me how i can display display field types of access tables in a text box using vba? I have no idea how i can obtain that information using vba. Looking forward to your replys.Thanks

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: How to display field types of access tables in vba?

    Depending on whether you are using ADO or DAO its slightly different. For ADO you need to look at ADOX.

    General principle is to get a variable as the object and loop through its properties/methods

    example
    Code:
    rs.fields.count '<-- recordset object, fields, count being the number of them
    rs.fields(0).name '<-- the name of field at 0 (might be position 1 for start - you experiment and post up ;) )
    There are tutorials online for this, so perhaps a search on yahoo or google may produce helpful hints?
    www.vbworld.com used to have examples, whether they do now I dunno... but there are other places...uhmm www.w3schools.com

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Re: How to display field types of access tables in vba?

    Quote Originally Posted by Ecniv
    Depending on whether you are using ADO or DAO its slightly different. For ADO you need to look at ADOX.

    General principle is to get a variable as the object and loop through its properties/methods

    example
    Code:
    rs.fields.count '<-- recordset object, fields, count being the number of them
    rs.fields(0).name '<-- the name of field at 0 (might be position 1 for start - you experiment and post up ;) )
    There are tutorials online for this, so perhaps a search on yahoo or google may produce helpful hints?
    www.vbworld.com used to have examples, whether they do now I dunno... but there are other places...uhmm www.w3schools.com
    Thank u for u reply . I be happy if u show me the complete sub since i am very new to ado. What actually i am trying to do is generate a new create table statments and write it to a file.So my first step is to learn how to display all the fields type!

  4. #4
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: How to display field types of access tables in vba?

    Are you knowledgable in VB/VBA ??
    If not, then you definitely need to start with some tutorials on ADO VBA/VB. Any code I post won't mean much.

    Tell you what. Read up and try a tutorial or two (you find them) then make a new program/mdb and try on your own. As soon as you have some code (even if it doesn't work) post that up and perhaps we can assist in correcting the mistakes?

    Are you doing this for work or for an assignment (college/uni)?

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Re: How to display field types of access tables in vba?

    Quote Originally Posted by Ecniv
    Are you knowledgable in VB/VBA ??
    If not, then you definitely need to start with some tutorials on ADO VBA/VB. Any code I post won't mean much.

    Tell you what. Read up and try a tutorial or two (you find them) then make a new program/mdb and try on your own. As soon as you have some code (even if it doesn't work) post that up and perhaps we can assist in correcting the mistakes?

    Are you doing this for work or for an assignment (college/uni)?
    Well i want learn this for my future job hunting. so i started to learn meta data vba programing and i can not fine a good book or article for it!

  6. #6
    Addicted Member
    Join Date
    Jan 2002
    Location
    Glasgow, Scotland
    Posts
    202

    Re: How to display field types of access tables in vba?

    Tony,

    perhaps you should take the advice, and buy yourself a book.

    and perhaps, keep all of your posts in a single thread instead of posting several random questions about things you obviously have no understanding of at all. this is called spamming on most forums

    make an effort to learn what you want first, then assistance would be easier to come by.

    and what do you mean by meta data vb programming?

    meta tag programming for example is HTML
    VB is not the same thing.

    perhaps i am misunderstanding what you mean.
    if you fail to plan, you plan to fail

  7. #7
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: How to display field types of access tables in vba?

    Brian: just found this - might be what Tony wants to (sort of) do Here

    Tony:
    If the above link is what you are thinking of doing, you do really need a base to start from.
    As you say you are looking at this as a prospective job role (I haven't heard of it until now) you may want to rethink a bit
    Have you actually seen roles for this type of job anywhere?
    How much experience are they asking for?
    If you want Office VBA (Access/Excel) for manipulating data, these forums can help, but you really need a goal or project to use. Mainly because tutorials (although useful in giving ideas) tend not to be realistic in the long term.
    If you are in a job at the moment, and want to do VBA things, see what you can find for mini projects.

    Excel VBA is mainly used for repetative tasks, that you can get the comp to do for you. Access VBA is up to you. I prefer VBA (personal preference) to using the bound forms, but I've done Access Dbs for ages. I've also found that my experience of VBA Access helped with Excel.

    Main point being, if you want to learn it to assist job hunting, then start with a tutorial, then move to office useful stuff. Mainly because people give you feedback on your macros in the office (bad/good/excellent/timesaver/accurate/moneysaver).

    Have I waffled too much??

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width