Solved

Spell Check, kind of

Posted on 2012-03-16
13
300 Views
Last Modified: 2012-03-21
I have a form with a submit button.
The submit button runs code that pulls information from the form to create a url.  
Application.FollowHyperlink "http://server3/alert/phone.aspx/SendTTS?msg=This is building" & Me.Ctl1Building & ". " & Me.Ctl1Area & ".  We have " & Me.Ctl1Assigned & " Personnel Assigned. There are " & Me.Ctl1Accounted_For & ". Personnel Present. " & "&numbers=1324657980&callerID=1234567890&user=callme&pass=callme"

Open in new window


The trouble is that if any of the fields contain an "&" sign, the code drops from that point, and I only get a partial report.  

To fix this, before executing this code, I want to search all the fields for an "&" and remove it if it exists.  Can it be done?

Tony
0
Comment
Question by:TIgerV
  • 4
  • 4
  • 3
  • +1
13 Comments
 
LVL 15

Expert Comment

by:Simon Ball
ID: 37729640
field = replace(field,"&","")

chec in help for the replace paramaters... it has start position, and replace all instances too..

so you can start at the nth character and replace 1st, or all instaces of & with ""
0
 
LVL 15

Expert Comment

by:Simon Ball
ID: 37729646
or just use replace(...) in the concat string.
0
 

Author Comment

by:TIgerV
ID: 37729669
Where do I put that?
Also- Isn't there a command to NOT ALLOW that key?
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37729829
Build the hyperlink in a variable *First*, ...then do follow hyperlink...

Dim strMyHyperLink as string

strMyHyperLink ="http://server3/alert/phone.aspx/SendTTS?msg=This is building" & Me.Ctl1Building & ". " & Me.Ctl1Area & ".  We have " & Me.Ctl1Assigned & " Personnel Assigned. There are " & Me.Ctl1Accounted_For & ". Personnel Present. " & "&numbers=1324657980&callerID=1234567890&user=callme&pass=callme"

Application.FollowHyperlink strMyHyperLink

JeffCoachman
0
 
LVL 45

Expert Comment

by:aikimark
ID: 37730181
Instead of removing the ampersands, encode them to URI standards.  

There are two choices:
* Change all "&" with "&"
* Change all "&" with "%26"
0
 

Author Comment

by:TIgerV
ID: 37730193
The problem is that if one of the fields contains an "&", it breaks up the API input.  I need to remove any "&" sign within the fields before making the URL.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37730459
did you try my suggestion?
0
 

Author Comment

by:TIgerV
ID: 37730492
Your suggestion does not solve the issue of too many "&" signs.
0
 
LVL 45

Expert Comment

by:aikimark
ID: 37730577
did you to the %26 conversion?
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37730580
..works fine for me...
0
 

Author Comment

by:TIgerV
ID: 37748393
The API does not accept %26, only a real "&".
0
 
LVL 45

Expert Comment

by:aikimark
ID: 37748432
have you tried repeating the ampersand character?

(like we do when we need a quote character inside a quoted string)
0
 
LVL 45

Accepted Solution

by:
aikimark earned 500 total points
ID: 37749638
This will replace all the ampersand characters with space characters.

Application.FollowHyperlink "http://server3/alert/phone.aspx/SendTTS?msg=This is building" & Replace(Me.Ctl1Building, "&"," ") & ". " & Replace(Me.Ctl1Area, "&"," ") & ".  We have " & Replace(Me.Ctl1Assigned, "&"," ") & " Personnel Assigned. There are " & Replace(Me.Ctl1Accounted_For, "&"," ") & ". Personnel Present. " & "&numbers=1324657980&callerID=1234567890&user=callme&pass=callme"

Open in new window

0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Outlook Free & Paid Tools
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now