Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 15th, 2004, 04:27 PM
jangann jangann is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 6 jangann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Wildcard query from form

Hi. I'm trying to get a form based query going for a database of individual dolphin sightings. The relevant fieldsare "dolph1" dolph2", up to "dolph45" (an individual animal is entered into these, starting at dolph1 and continuing until all animals are in one of the fields (randomly entered)) and *more importantly* there is a final field called "dolphs" -- with all of the individuals in it, each seperated by a space. So I can filter for individuals in that field, and I can query for them as well by entering Like "*bktl*", where bktl is a code for 1 animal I am interested in.

My difficulty is in running a wildcard query in conjunction with a form. I want the user to enter the animal they are interested in via a form, then a cmd button will run a query in the "dolphs" field -- which would make it a wildcard. I have tried Like " * Forms![animals]![txtAnimal] * ", where my form name is animals and the txt box with input is txtanimal. I get no records. Any ideas?

Reply With Quote
  #2  
Old March 15th, 2004, 10:11 PM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 8 m 57 sec
Reputation Power: 9
Send a message via ICQ to stumpy Send a message via MSN to stumpy
Don't put any spaces in your LIKE statement - the DB checks for the exact string. So your query should look like:
Code:
WHERE dolphs LIKE '*Forms![animals]![txtAnimal]*'
__________________
DevArticles Moderator
BlueSix - Web Development and Consulting

Reply With Quote
  #3  
Old March 16th, 2004, 09:54 AM
jangann jangann is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 6 jangann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks

I'll try that -- JanGann

Reply With Quote
  #4  
Old March 16th, 2004, 10:10 AM
jangann jangann is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 6 jangann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
No luck with that

I tried the "where dolphs Like '*Forms![animals]![txtAnimal]*' with no luck (see attached .gif of query). Any more ideas out there? Any help is greatly appreciated! -- JanGann
Attached Images
File Type: gif query.gif (16.9 KB, 366 views)

Reply With Quote
  #5  
Old March 16th, 2004, 05:07 PM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 8 m 57 sec
Reputation Power: 9
Send a message via ICQ to stumpy Send a message via MSN to stumpy

Reply With Quote
  #6  
Old March 17th, 2004, 04:17 PM
jangann jangann is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 6 jangann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
It worked!

Needed the &'s in there. Here's the query criteria:

Like "*" & [Forms]![FormName]![EntryFieldName].value & "*"

Thanks for the link. -- JanGann

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > Wildcard query from form


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT