Mapping

  • Thread starter Thread starter Jessica
  • Start date Start date
J

Jessica

I want to insert a button to map the address listed in a form. Can someone
help me with this?
 
Sorry for the vague question...while I am very proficient in other Office
Apps, I am very new to Access and extremely overwhelmed.

I am designing a contact management database for my non-profit. I want to
add a button to the contact form that will map the contact's address by, I
guess, linking to live.maps.com. Is this even possible? If so, how?

Thanks!
 
Here is the code form a command button where I open a browser and navigate
to a page.
The actual values you pass will, of course, depend on the requirements of
the site.

Private Sub cmdTestDirector_Click()
Const conHyperLink As String =
"testdirector:rpidaletd003.corp.realpage.com:8080/" & _
"qcbin,DEFAULT,OneSiteDevelopment,NameHere,PasswordHere;2:TaskNumberHere"
Dim strPwd As String
Dim strUser As String
Dim strhyperlink As String

strUser = GetUserID
strPwd = Nz(DLookup("[TestDirectorPassword]", "dbo_employee",
"[EmployeeLogin] = """ & _
strUser & """"), vbNullString)
If strPwd = vbNullString Then
MsgBox strUser & " Not Found in the Employee Table" & vbNewLine & _
"Please contact an administrator", vbExclamation, conMsgTitle
Else
strhyperlink = Replace(conHyperLink, "NameHere", strUser)
strPwd = EncryptCode(1, strPwd)
strPwd = Replace(strPwd, "None", vbNullString)
strhyperlink = Replace(strhyperlink, "PasswordHere", strPwd)
strhyperlink = Replace(strhyperlink, "TaskNumberHere",
Me.txtTaskNumber)
Call fHandleFile(strhyperlink, WIN_NORMAL)
' Me.cmdClose.SetFocus
End If
End Sub


Here is the code for the fHandleFile function.
I can't remember where I downloaded it from or who wrote it I think it is
Dev Ashish.

'***************Usage Examples***********************
'Open a folder: ?fHandleFile("C:\TEMP\",WIN_NORMAL)
'Call Email app: ?fHandleFile("mailto:[email protected]",WIN_NORMAL)
'Open URL: ?fHandleFile("http://home.att.net/~dashish", WIN_NORMAL)
'Handle Unknown extensions (call Open With Dialog):
' ?fHandleFile("C:\TEMP\TestThis",Win_Normal)
'Start Access instance:
' ?fHandleFile("I:\mdbs\CodeNStuff.mdb", Win_NORMAL)
'****************************************************

Function fHandleFile(stFile As String, lShowHow As Long)
Dim lRet As Long, varTaskID As Variant
Dim stRet As String
'First try ShellExecute
lRet = apiShellExecute(hWndAccessApp, vbNullString, _
stFile, vbNullString, vbNullString, lShowHow)

If lRet > ERROR_SUCCESS Then
stRet = vbNullString
lRet = -1
Else
Select Case lRet
Case ERROR_NO_ASSOC:
'Try the OpenWith dialog
varTaskID = Shell("rundll32.exe shell32.dll,OpenAs_RunDLL "
_
& stFile, WIN_NORMAL)
lRet = (varTaskID <> 0)
Case ERROR_OUT_OF_MEM:
stRet = "Error: Out of Memory/Resources. Couldn't Execute!"
Case ERROR_FILE_NOT_FOUND:
stRet = "Error: File not found. Couldn't Execute!"
Case ERROR_PATH_NOT_FOUND:
stRet = "Error: Path not found. Couldn't Execute!"
Case ERROR_BAD_FORMAT:
stRet = "Error: Bad File Format. Couldn't Execute!"
Case Else:
End Select
End If
fHandleFile = lRet & _
IIf(stRet = "", vbNullString, ", " & stRet)
End Function
 
Well, I am in over my head. I am not familiar with this. Thanks anyway!

Klatuu said:
Here is the code form a command button where I open a browser and navigate
to a page.
The actual values you pass will, of course, depend on the requirements of
the site.

Private Sub cmdTestDirector_Click()
Const conHyperLink As String =
"testdirector:rpidaletd003.corp.realpage.com:8080/" & _
"qcbin,DEFAULT,OneSiteDevelopment,NameHere,PasswordHere;2:TaskNumberHere"
Dim strPwd As String
Dim strUser As String
Dim strhyperlink As String

strUser = GetUserID
strPwd = Nz(DLookup("[TestDirectorPassword]", "dbo_employee",
"[EmployeeLogin] = """ & _
strUser & """"), vbNullString)
If strPwd = vbNullString Then
MsgBox strUser & " Not Found in the Employee Table" & vbNewLine & _
"Please contact an administrator", vbExclamation, conMsgTitle
Else
strhyperlink = Replace(conHyperLink, "NameHere", strUser)
strPwd = EncryptCode(1, strPwd)
strPwd = Replace(strPwd, "None", vbNullString)
strhyperlink = Replace(strhyperlink, "PasswordHere", strPwd)
strhyperlink = Replace(strhyperlink, "TaskNumberHere",
Me.txtTaskNumber)
Call fHandleFile(strhyperlink, WIN_NORMAL)
' Me.cmdClose.SetFocus
End If
End Sub


Here is the code for the fHandleFile function.
I can't remember where I downloaded it from or who wrote it I think it is
Dev Ashish.

'***************Usage Examples***********************
'Open a folder: ?fHandleFile("C:\TEMP\",WIN_NORMAL)
'Call Email app: ?fHandleFile("mailto:[email protected]",WIN_NORMAL)
'Open URL: ?fHandleFile("http://home.att.net/~dashish", WIN_NORMAL)
'Handle Unknown extensions (call Open With Dialog):
' ?fHandleFile("C:\TEMP\TestThis",Win_Normal)
'Start Access instance:
' ?fHandleFile("I:\mdbs\CodeNStuff.mdb", Win_NORMAL)
'****************************************************

Function fHandleFile(stFile As String, lShowHow As Long)
Dim lRet As Long, varTaskID As Variant
Dim stRet As String
'First try ShellExecute
lRet = apiShellExecute(hWndAccessApp, vbNullString, _
stFile, vbNullString, vbNullString, lShowHow)

If lRet > ERROR_SUCCESS Then
stRet = vbNullString
lRet = -1
Else
Select Case lRet
Case ERROR_NO_ASSOC:
'Try the OpenWith dialog
varTaskID = Shell("rundll32.exe shell32.dll,OpenAs_RunDLL "
_
& stFile, WIN_NORMAL)
lRet = (varTaskID <> 0)
Case ERROR_OUT_OF_MEM:
stRet = "Error: Out of Memory/Resources. Couldn't Execute!"
Case ERROR_FILE_NOT_FOUND:
stRet = "Error: File not found. Couldn't Execute!"
Case ERROR_PATH_NOT_FOUND:
stRet = "Error: Path not found. Couldn't Execute!"
Case ERROR_BAD_FORMAT:
stRet = "Error: Bad File Format. Couldn't Execute!"
Case Else:
End Select
End If
fHandleFile = lRet & _
IIf(stRet = "", vbNullString, ", " & stRet)
End Function


Jessica said:
I want to insert a button to map the address listed in a form. Can someone
help me with this?
 
You can insert a hyperlink control which will go to a given URL.
You then need to figure out what has to be passed in the URL to plug in the
specific address.
See if you can find another website that does something similar and copy
whatever the URL contains.
It might be something like
http://www.maps.com?zipcode='10601'

-Dorian
 
Back
Top