Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select statement

Status
Not open for further replies.

cschaffer

IS-IT--Management
Aug 21, 2001
196
CA
strQuery = "SELECT DisasterName, DisasterType, Detail, Date, Country FROM Disasters WHERE DisasterType = '" & isit1 & "'" '&' "Date = #" & isit2 & "#" '&' "Country = '" & isit3 & "'"

*********************************************
That is my code....it works ...kind of......Now what I am trying to get here is to display the results only if ALL the conditions are met...what it is doing now is displaying the results of 'DisasterType'........and doesn't care about the rest of the conditions.......thanks for the help....

CS
 
I think you need to add some spaces and some "ands" into your query. Translating the variables you've pasted above into a SQL statement, here's what you get:

SELECT DisasterName, DisasterType, Detail, Date, Country FROM Disasters WHERE DisasterType = 'isit1name'&Date = #isit2date#&Country = 'isit3field'


Should read like this:


SELECT DisasterName, DisasterType, Detail, Date, Country FROM Disasters WHERE DisasterType = 'isit1name' AND Date = #isit2date# AND Country = 'isit3field'

Maq B-)
<insert witty signature here>
 
Thanks ...altough that gives me the same results.....

:)

CS
 
Hmmm, I would suggest inserting a msgbox into your VBA code to display exactly what your SQL string looks like. Perhaps when you see the actual sql statement, you'll be able to see what's wrong with it.

If you can't see it, then post the statement here. Perhaps someone else can see something we've missed. Maq B-)
<insert witty signature here>
 
Please post some sample data and the results you would like to see... Terry M. Hoey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top