Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 363
  • Last Modified:

Spell Check, kind of

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
TIgerV
Asked:
TIgerV
  • 4
  • 4
  • 3
  • +1
1 Solution
 
Simon BallCommented:
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
 
Simon BallCommented:
or just use replace(...) in the concat string.
0
 
TIgerVAuthor Commented:
Where do I put that?
Also- Isn't there a command to NOT ALLOW that key?
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
Jeffrey CoachmanMIS LiasonCommented:
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
 
aikimarkCommented:
Instead of removing the ampersands, encode them to URI standards.  

There are two choices:
* Change all "&" with "&"
* Change all "&" with "%26"
0
 
TIgerVAuthor Commented:
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
 
Jeffrey CoachmanMIS LiasonCommented:
did you try my suggestion?
0
 
TIgerVAuthor Commented:
Your suggestion does not solve the issue of too many "&" signs.
0
 
aikimarkCommented:
did you to the %26 conversion?
0
 
Jeffrey CoachmanMIS LiasonCommented:
..works fine for me...
0
 
TIgerVAuthor Commented:
The API does not accept %26, only a real "&".
0
 
aikimarkCommented:
have you tried repeating the ampersand character?

(like we do when we need a quote character inside a quoted string)
0
 
aikimarkCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

  • 4
  • 4
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now