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
> Matching Data To Field Value, Need Mask, Access 2016    
 
   
arpirnat
post Jan 12 2018, 11:00 AM
Post#1



Posts: 110
Joined: 25-June 16



I have a field value for SSN. We use masks but do not store the data with the -'s.
We have now linked the database to a Reflection window and need to compare the data:
CODE
If InStr(Reflection.GetText(0, 0, 2, 29), Forms!frmToChart.Form!SSN) > 0 Then


The issue is the Reflection shows the SSN as 111-11-1111 while the data on the database is stored as 111111111. Even though the mask displays it as 111-11-1111 they do not see eachother as matches. If I remove the mask and enter the -'s manually it works fine. I know an obvious way to fix this would be to go through all SSN's and add these, but just curious if there is a way to just make VB think the -'s are there when looking at the field value? I cannot change Reflection data so it will have to be on the DB side smile.gif
Go to the top of the page
 
theDBguy
post Jan 12 2018, 11:06 AM
Post#2


Access Wiki and Forums Moderator
Posts: 73,926
Joined: 19-June 07
From: SunnySandyEggo


How about using the Format() function when comparing the values? For example:

CODE
If InStr(Reflection.GetText(0, 0, 2, 29), Format(Forms!frmToChart.Form!SSN, "000-00-0000")) > 0 Then

Just a thought...
Go to the top of the page
 
arpirnat
post Jan 12 2018, 11:10 AM
Post#3



Posts: 110
Joined: 25-June 16



Worked great!

Thanks!
Go to the top of the page
 
theDBguy
post Jan 12 2018, 11:22 AM
Post#4


Access Wiki and Forums Moderator
Posts: 73,926
Joined: 19-June 07
From: SunnySandyEggo


Hi,

You're welcome. Glad we could assist. Good luck with your project.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    11th December 2018 - 11:55 AM