Results 1 to 8 of 8
  1. #1
    alexandre
    Guest

    Connecting to a dbf file to pick up data. (VBA/WORD2000/SR1)

    Which Library reference do I need to connect to a DBF file ?
    What code do I use to connect to the dbf file?
    <img src=/S/hairout.gif border=0 alt=hairout width=31 height=23>

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Connecting to a dbf file to pick up data. (VBA/WORD2000/SR1)

    Although dbf files are usually a dBase format file that can be read by just about everything, they can also be FoxPro files and I'm not sure what the differences might be. You need either a DAO or an ADO reference set if you want to create and manipulate recordset in code.

    What exactly are you trying to do? It isn't possible to give you a good answer without knowing what you mean by "connect to the dbf file". Do you just want to use it as the data source for a mail merge, or what?
    Charlotte

  3. #3
    alexandre
    Guest

    Re: Connecting to a dbf file to pick up data. (VBA/WORD2000/SR1)

    Charlotte,
    I just want to use it as a datasource.
    I do not want to use it with mailmerge,
    I want to populate the dbase table with the user's info, so I can ulater use it to populate a user dropdown combobox in a form, then from the choice, put the correct user info in a letter.
    I would get the data from the table and put it where I had previously bookmarked for data to be placed.
    dbasetable= z:word-dbuser.dbf
    table fields=
    Lkupname (to populate combobox)
    fullname
    Email
    Phone
    Fax

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Connecting to a dbf file to pick up data. (VBA/WORD2000/SR1)

    Then this isn't a file from somewhere else, it's something you're using as a data store? If that's so, why use the dbf format. You could do it easier using Excel or even Access or just a plain tab-delimited text file.
    Charlotte

  5. #5
    alexandre
    Guest

    Re: Connecting to a dbf file to pick up data. (VBA/WORD2000/SR1)

    How do I get data from an Excel Spreadsheet?
    suppose the spreadsheet is user.xls
    and I populate it with the analogous fields from the dbf file.
    How do I connect to the excel datasource?
    Directly or through a stored query procedure?

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Connecting to a dbf file to pick up data. (VBA/WORD2000/SR1)

    Well, it depends on exactly what you want to do. You can actually embed an Excel 2000 worksheet in a Word doc, so you could do it that way and then reference it in code. You can also store your data in a tab-delimited text file and simply open it in Word. That gives you a table that you can manipulate using Word's database tools without needing the Excel file.
    <hr>I would get the data from the table and put it where I had previously bookmarked for data to be placed.<hr>
    this suggests that a text file might be the simplest method, with the additional benefit that you can open the text file in Excel or in Word and look at the data directly or use it for other purposes. A tab delimited text file opens in Word as a table, and you can add rows to it or edit it as you go along. Be careful that you don't use too many columns though. Word, at least through 97, limited the columns in a table to 32 total, so all the columns after 31 were banged together into garbage in the last column.
    Charlotte

  7. #7
    alexandre
    Guest

    Re: Connecting to a dbf file to pick up data. (VBA/WORD2000/SR1)

    the spreadsheet would only have the following fields
    (I mean columns):
    file= z:word-dbuser.xlw
    columns:
    Lkupname (to populate combobox)
    fullname
    Email
    Phone
    Fax

    what code would i use to get data from the spreadsheet column lkupname into a combobox?

  8. #8
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Connecting to a dbf file to pick up data. (VBA/WORD2000/SR1)

    Lookup AddItem in the on-line help. That should give you an example of populating a combobox from code. If you have problems with it, post back here.
    Charlotte

Posting Permissions

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