Solved

Spell Check, kind of

Posted on 2012-03-16
13
284 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
Comment Utility
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
Comment Utility
or just use replace(...) in the concat string.
0
 

Author Comment

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

Expert Comment

by:Jeffrey Coachman
Comment Utility
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
Comment Utility
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
Comment Utility
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
did you try my suggestion?
0
 

Author Comment

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

Expert Comment

by:aikimark
Comment Utility
did you to the %26 conversion?
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
..works fine for me...
0
 

Author Comment

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

Expert Comment

by:aikimark
Comment Utility
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
Comment Utility
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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

This article will show you how to use shortcut menus in the Access run-time environment.
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…
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…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

763 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

11 Experts available now in Live!

Get 1:1 Help Now