...

View Full Version : query database from 2 variables



startbar
01-21-2005, 09:56 PM
Hi,

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

Any ideas? Thanks

miranda
01-22-2005, 12:20 AM
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 & "'"

startbar
01-22-2005, 12:42 AM
thanks, ill try that out and let you know!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum