+ Reply to Thread
Results 1 to 3 of 3

Variable Database Query

  1. #1
    Forum Contributor
    Join Date
    07-21-2009
    Location
    Sheffield, England
    MS-Off Ver
    Excel 2010
    Posts
    117

    Variable Database Query

    Hello, I have recorded a macro to perform a database query, but I would like an input box to prompt the end user to enter the data they would like to query.

    This is the department ID (e.g. 123456)

    I have so far got the following code:

    Please Login or Register  to view this content.
    How can I get my variable 'ccode' to replace the DeptDB.Departmentcentre value (123456) ?

    "WHERE (DeptDB.Departmentcentre='123456') A"

    Cheers
    Tom

  2. #2
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264

    Re: Variable Database Query

    Hi

    Change the commandtext line to:

    Please Login or Register  to view this content.
    Richard
    Richard Schollar
    Microsoft MVP - Excel

  3. #3
    Forum Contributor
    Join Date
    07-21-2009
    Location
    Sheffield, England
    MS-Off Ver
    Excel 2010
    Posts
    117

    Re: Variable Database Query

    Thanks for that very much appreciated - I did something similar but didn't put the '' between the ""

    Cheers!!

+ 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