UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Search Help, Any Version    
 
   
Surico
post Jan 11 2018, 12:34 PM
Post#1



Posts: 50
Joined: 22-August 16



Hi Everyone,

I created this archive database with help on this site before and it's working quite well I do have a query which hopefully someone can help me with.

when searching for a client name, I have the search code set so it searches any part of the name you ask (So for example if the client is called John Smith and you type in Jo any result with "JO" will come back) but I was wondering could the code be edited to incorporate the symbol ' symbol? when I type in someone's name with that symbol it comes up with an error, so I was hoping to be able to for example when searching for someone called O'Driscoll I can do it without the error coming up.

Is that possible?
Attached File(s)
Attached File  Archive_System_Rev2.zip ( 413.4K )Number of downloads: 3
 
Go to the top of the page
 
theDBguy
post Jan 11 2018, 12:41 PM
Post#2


Access Wiki and Forums Moderator
Posts: 71,430
Joined: 19-June 07
From: SunnySandyEggo


Hi,

Try changing anywhere you have something like this:

CODE
"[Client Name] like '*" & Me.TxtSearch2 & "*'"


into this:

CODE
"[Client Name] like ""*" & Me.TxtSearch2 & "*"""


Hope it helps...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
Surico
post Jan 12 2018, 04:45 AM
Post#3



Posts: 50
Joined: 22-August 16



Hey mate,

thanks, I entered the code but it didn't work.

I'av attached the code and error prompt.
Attached File(s)
Attached File  Code.zip ( 359.22K )Number of downloads: 3
 
Go to the top of the page
 
theDBguy
post Jan 12 2018, 11:31 AM
Post#4


Access Wiki and Forums Moderator
Posts: 71,430
Joined: 19-June 07
From: SunnySandyEggo


Hi,

It looks like you didn't finish changing all instances of the code. You fixed the first instance (inside DCount) but did not fix the second one (on the OpenForm line).

So, for this particular error, try replacing this line:

CODE
DoCmd.OpenForm "File Database", acNormal, , "[Client Name] like '*" & Me.TxtSearch2 & "*'"

with this one:

CODE
DoCmd.OpenForm "File Database", acNormal, , "[Client Name] like ""*" & Me.TxtSearch2 & "*"""


Remember, you'll have to change ALL instances in your code where you have a single quote and replace it with double quotes. Otherwise, the error will just keep moving around until you fix all of them.

Hope it helps...

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 
Surico
post Jan 12 2018, 11:33 AM
Post#5



Posts: 50
Joined: 22-August 16



Hi,

Yeah I just figured that out (forgive me it's Friday lol)

Thank you!!!!
This post has been edited by Surico: Jan 12 2018, 11:34 AM
Go to the top of the page
 
theDBguy
post Jan 12 2018, 11:34 AM
Post#6


Access Wiki and Forums Moderator
Posts: 71,430
Joined: 19-June 07
From: SunnySandyEggo


Okay, glad to hear you got it sorted out. Good luck with your project.

--------------------
Just my 2 cents... "And if I claim to be a wise man, it surely means that I don't know" - Kansas
Microsoft Access MVP | Access Website | Access Blog | Email
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    22nd January 2018 - 09:13 AM