Solved

Spell Check, kind of

Posted on 2012-03-16
13
308 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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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
 
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Combobox row source 2 20
Access on Mouse move 5 31
backup programme - VBA 3 24
Access: Retrieving Current Month's Orders for Invoice 6 27
Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
My experience with Windows 10 over a one year period and suggestions for smooth operation
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.
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

776 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