Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Invalid Use of . Dot

Status
Not open for further replies.

legalkill

Technical User
Nov 27, 2001
11
I made a button that simply opens internet explorer and a url that is a compilation of address fields and text that would make the Mapquest url. (
the button click event is:

Dim stAppName As String

stAppName = "c:\program files\internet explorer\iexplore.exe " + [Mapquest]
Call Shell(stAppName, 1)

where mapquest is the field on the form that compiles the url. It works on a variety of machines but does not work on others. The ones that it does not work on errors with "invalid use of . dot" on the machines that it does not work i can take the mapquest field out and it will open IE just fine.

What could be the issue and/or a better way of doing this.
 
Ok i figured out that the computers that don't work don't recognize the vb command "replace". I use the expression:

=" & Replace([locationaddress]," ","+") & "&2c=" & [locationcity] & "&2s=" & [locationstate] & "&2z=" & [locationzip]

to format the url for the mapquest. However to replace the spaces with a "+" in the appropriate places I use the replace command. Where do i update the VB on those computers so that they recognize the replace command or is there a better way to gather the correct url string.
 
legalkill,

I assume since you do not have the replace function you must be using Access 97. Then create your own replace module.

Code:
'=============================================================
' Declarations section of the module
'=============================================================
Option Explicit

Function Replace(ByVal Valuein As String, ByVal WhatToReplace As String, ByVal Replacevalue As String) As String
    Dim Temp as String, P As Long
    Temp = Valuein
    P = Instr(Temp, WhatToReplace)
      Do While P > 0
         Temp=Left(Temp, P-1) & Replacevalue & Mid(Temp, P+Len(WhatToReplace))
         P = InStr(P + Len(Replacevalue), Temp, WhatToReplace, 1)
      Loop
      Replace = Temp
      End Function

Usage as follows..

Replace("This is your Town","Town","City") returns:
This is your City

I hope this helps.

[thumbsup2]
 
HitechUser, to make the code coherent, I'd replace this:
P = Instr(Temp, WhatToReplace)
By this:
P = Instr(1, Temp, WhatToReplace, 1)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Actually they are office 2000 (access 2000) on mixed op systems (xp-98), Office XP (2002) and above run the replace command on mixed op sys (ME-XP). But thanks I will try the code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top