-
Aug 21st, 2012, 12:59 PM
#1
Thread Starter
Addicted Member
[RESOLVED] Search Database
Hello, I am trying to create a search function for the phone number in my database, but i used a space in phone number. So now its name is [phone numb.]
I want to know how to refer to it in the filter cell in query builder. -- LIKE @phone numb. + '%' -- doesn't work. And nothing else I have tried.
Thanks in advance.
-
Aug 22nd, 2012, 04:47 AM
#2
Re: Search Database
You should never have a field name with spaces/punctuation/etc in, because there are various situations where it causes problems - some of them to the point where you cannot use that field/table, as there is no way to 'fix' it (and this could well be one of them).
Unless you have an extremely good reason for having the name like that (making things 'easier' is not a good reason, and probably not even true), change it to something else, eg: PhoneNumber
For more information, see the article What names should I NOT use for tables/fields/views/stored procedures/...? from our Database Development FAQs/Tutorials (at the top of the Database Development forum)
-
Aug 22nd, 2012, 05:15 AM
#3
Re: Search Database
Originally Posted by ikdekker
Hello, I am trying to create a search function for the phone number in my database, but i used a space in phone number. So now its name is [phone numb.]
I want to know how to refer to it in the filter cell in query builder. -- LIKE @phone numb. + '%' -- doesn't work. And nothing else I have tried.
Thanks in advance.
Not using spaces in column names aside it doesn't matter what you have in the variable set up as far as spaces in the column are concerned. Something like this should work. Of course what the data looks like does matter.
"where [phone numb] like '" & @phone & "%'"
Assuming @Phone has the number you are looking for and it is formatted to match what is stored in the database.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|