|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
MS Access and SQL
Hi -
I'm in the unfortunate position of having to run a SQL query through Access. What I'm trying to accomplish is to search for records that contain keywords within a text field. This is the query I have written: SELECT TblBusinessInformation.FldComments, TblBusinessInformation.FldBusinessId, TblBusinessInformation.FldCompanyName, TblBusinessInformation.FldBusinessAddress1, TblBusinessInformation.FldBusinessAddress2, TblBusinessInformation.FldBusinessCity, TblBusinessInformation.FldBusinessState, TblBusinessInformation.FldBusinessZipCode FROM TblBusinessInformation WHERE (((TblBusinessInformation.FldComments) Like "FEMA" & "SBA" Or (TblBusinessInformation.FldComments) Is Null)); It doesn't seem to be returning the correct results. Can anyone see anything wrong with this? Also, is it possible to run a NOT LIKE? Thanks, Jd |
|
#2
|
|||
|
|||
|
SELECT TblBusinessInformation.FldComments, TblBusinessInformation.FldBusinessId,
TblBusinessInformation.FldCompanyName, TblBusinessInformation.FldBusinessAddress1, TblBusinessInformation.FldBusinessAddress2, TblBusinessInformation.FldBusinessCity, TblBusinessInformation.FldBusinessState, TblBusinessInformation.FldBusinessZipCode FROM TblBusinessInformation WHERE (((TblBusinessInformation.FldComments) Like "FEMA" & "SBA" Or (TblBusinessInformation.FldComments) Is Null)); The bold text is where is see a possible problem. 1) I'm not sure about the double quotes, I've always used single quotes. Not sure if it matters or not, but I would assume it does. 2) The "like" argument is saying the entire field should be "fema" or whatever, not just a certain part of it. You want a different argument there, off the top of my head, I can't recall it. "IN" maybe??? Sorry bout the ramblin'. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > Windows Help > MS Access and SQL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|