Hey guys and gals I have an Access database with a button that I hit to map addresses, it used to work when I was using MS Access 2007(which is what the database was built in) and Windows Vista 32 bit. I recently upgraded to Windows 7 64 bit and MS Access 2010.
Option Compare Database
Option Explicit
Function OpenMap(Address, City, State, Zip)
Dim strAddress As String
strAddress = Nz(Address)
strAddress = strAddress & IIf(strAddress = "", "", ", ") & Nz(City)
strAddress = strAddress & IIf(strAddress = "", "", ", ") & Nz(State)
strAddress = strAddress & IIf(strAddress = "", "", ", ") & Nz(Zip)
If strAddress = "" Then
MsgBox "There is no address to map."
Else
Application.FollowHyperlink "http://maps.google.com/maps?q=" & strAddress
End If
End Function
The Embedded macro is
RunCode
Function Name OpenMap([Address],[City],[State],[Zip])
Im not even sure Function Name or OpenMap is legitimate to use in Access 2010?
Pretty basic I guess. I didnt create this macro or module, just copy and pasted everything from an example database back when I built this database in access 2007. But now when I hit the button it says "The expression you entered has a function name Microsoft Access cant find"
It then opens a window called macro single step and says
Macro Name: Wind Mitigation Pictures : cmdMap : OnClick : Embedded Macro
ActionName: RunCode
Arguments: OpenMap([Address],[City],[State],[Zip])
Error Number: 2425
The module name is OpenMap
When I run the debug nothing comes back at all... Any help or insight would be greatly appreciated, thanks!
What I do for a living:
Home Inspection and Wind Mitigation
http://www.FairWindInspections.com/
Posts
Home Inspection and Wind Mitigation
http://www.FairWindInspections.com/
There is an immediate problem with the code you copied, you have a semicolon outside the quotes there on the followhyperlink call. Is that actually like that in your code?
Second, I don't quite understand why you have this
Function Name OpenMap([Address],[City],[State],[Zip])
Try getting ride of Function Name and just having OpenMap(blahblahblah)
I think all you're doing there is calling the function, which you do by typing the function name. Not literally "Function Name"
Home Inspection and Wind Mitigation
http://www.FairWindInspections.com/