Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Jul 2004
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts

    query database from 2 variables

    Hi,

    how would i go about searching an access database for 2 variables such as Company name and Town/Area

    Any ideas? Thanks
    Web and Business Development from Cornwall - Startbar.co.uk

  • #2
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,065
    Thanks
    4
    Thanked 8 Times in 8 Posts
    mySqlQuery = "SELECT * FROM myTable WHERE company = 'companyName' AND town = 'townName'"

    Since you most likely won't know the names of the the company or the town then change to this

    dim strCompany, strTown
    strCompany = Request("company")
    strTown = Request("town")

    mySqlQuery = "SELECT * FROM myTable WHERE company = '" & strCompany & "' AND town = '" & strTown & "'"

  • #3
    Regular Coder
    Join Date
    Jul 2004
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks, ill try that out and let you know!
    Web and Business Development from Cornwall - Startbar.co.uk


  •  

    Posting Permissions

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