+ Reply to Thread
Results 1 to 6 of 6

Using data entered in prompt to search database table

  1. #1
    Registered User
    Join Date
    02-23-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    8

    Question Using data entered in prompt to search database table

    Hey, I will try to explain what I want to do:

    When I open a document, there will be prompt to enter the EmployeeID. The id entered will be used to search the data source, in this case a database table, and data like name and phone will be retrieved and displayed on the word document like shown:

    EmployeeID: (from the prompt)
    Name: (from database table)
    Phone: (from database table)

    I am able to do the first part. I did it by using a fill-in box. I recorded a macro which selects the fill-in from Quick Parts from Insert. But I have no idea on know to do the rest of the part.

    Some help will be greatly appreciated.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Using data entered in prompt to search database table

    hi BluRay
    Roy has a very good downloadable example
    "J & R Database Form..."
    http://www.excel-it.com/vba_examples.htm
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Registered User
    Join Date
    02-23-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Using data entered in prompt to search database table

    Thanks pike. That is a impressive example. But I was looking for some simpler way involving word and macro. I don't know much about the VB codes.

    Oh, one thing, about the problem I asked, is it possible to accomplish this task using only word and macro?

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Using data entered in prompt to search database table

    Hi BluRay
    macro VBA are/mean the code

    stripped royUK code from userform example

    Please Login or Register  to view this content.
    worksheet functions "lookup"s or combine "Index" and "Match"
    from the thread
    http://www.excelforum.com/excel-work...orksheets.html

    =VLOOKUP(D2,Sheet2!A:K,11,False)

    =INDEX(Sheet2!K:K,MATCH(D4,Sheet2!A:A,0),1)

  5. #5
    Registered User
    Join Date
    02-23-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Using data entered in prompt to search database table

    Thanks pike

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Using data entered in prompt to search database table

    Have a look at this merge mail clip
    http://www.youtube.com/watch?v=_9ExKwXQ3KQ
    for the excel to word bit

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1