Hallo,
Frage von vorhin hat sich erledigt, weil ich ein besseres script hab (inzwischen) fuer eine Hyperlink auf das entsprechende Access formular. Alles wuerde klappen ich hab nur eine Frage:Was ist mit der [LocationID] gemeint, welches Feld soll ich dort eintragen? Waere fuer Hilfe sehr dankbar!
Gruss Christoph
Attribute VB_Name = "AccessHyperlink"
'The following VBScript is based on the GOTOaccess.zip script created by
'Steve Carson and posted on the ESRI site. It was modified on September 11, 2003
'by Kristina Callahan
'This script will hyperlink from a feature in ArcMap to a filtered form in
'Microsoft Access. Works for me using ArcGIS 8.2, Access 2000, and Windows 2000.
'The following modifications were made:
' (1) the original script required that the Access form be open. I added code
' that will launch the database and form from a hard-coded location.
' (2) the original script passed a number variable from ArcMap to Access. I
' modified the SQL statement to accomodate strings which required using Chr(34)
' to represent ASCII character for double quotes. SQL requires strings
' to be in quotation marks.
' (3) comments were added to (hopefully) make using the script a little
' easier.
'Import this module into ArcMap
' (1) Open VBE by selecting Tools|Macros|Visual Basic Editor
' (2) Select File|Import File and navigate and open AccessHyperlink.bas. This should
' add the module to the Project document(not the Normal document)
' (3) Select Tools|References and check the reference to 'Microsoft Access 9.0
' Object Library'
' (4) Replace "E:\bird.mdb" with the location and name of the database you want
' to use
' (2) Replace "e:\" with the drive letter so it is the same drive as (4)
' (3) Replace "frmLocation" with the name of the form you want to filter
' (4) Modify ("[LocationID]=" & Chr(34) & thestring & Chr(34)) - replace [LocationID] with
' with the name of the field you want to filter on. Note that you must use
' Chr(34) to represent double quotes if you are passing a string. You do not
' need it if you are passing a number.
' (5) Close VBE and return to ArcMap
' (6) Open the Layer Properties for the layer you want to hyperlink from and navigate
' to Display|Hyperlink
' (7) Check the box next to support hyperlinks and select the field you want to use.
' Select Macro and copy and paste Project.AccessHyperlink.Hyperlink into the box.
' Do not click Create.
' (8) Click OK to exit the Layer Properties window and try the hyperlink tool.
Declare Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation _
As String, ByVal lpFile As String, ByVal lpParameters _
As String, ByVal lpDirectory As String, ByVal nShowCmd _
As Long) As Long
Declare Function apiFindWindow Lib "User32" Alias "FindWindowA" _
(ByVal lpclassname As Any, ByVal lpCaption As Any) As Long
Global Const SW_SHOWNORMAL = 1
Sub Hyperlink(pLink, pLayer)
On Error GoTo eh:
Dim pHyperlink As IHyperlink
Set pHyperlink = pLink
Dim pFLayer As IFeatureLayer
Set pFLayer = pLayer
Dim thestring As String
thestring = pHyperlink.Link
Dim hwnd
Dim StartDoc
hwnd = apiFindWindow("OPUSAPP", "0")
'opens Microsoft Access database
StartDoc = ShellExecute(hwnd, "open", "E:\bird.mdb", "", "e:\", SW_SHOWNORMAL)
Dim Accapp As Access.Application
Set Accapp = GetObject("E:\bird.mdb")
Accapp.DoCmd.OpenForm "frmLocation", acNormal, , ("[LocationID]=" & Chr(34) & thestring & Chr(34))
Exit Sub
eh:
MsgBox "Something isn't working!"
End Sub
[img][/img][/u][u][/u][u][/u][u][i][/i][img][/img][u][/u]
Frage von vorhin hat sich erledigt, weil ich ein besseres script hab (inzwischen) fuer eine Hyperlink auf das entsprechende Access formular. Alles wuerde klappen ich hab nur eine Frage:Was ist mit der [LocationID] gemeint, welches Feld soll ich dort eintragen? Waere fuer Hilfe sehr dankbar!
Gruss Christoph
Attribute VB_Name = "AccessHyperlink"
'The following VBScript is based on the GOTOaccess.zip script created by
'Steve Carson and posted on the ESRI site. It was modified on September 11, 2003
'by Kristina Callahan
'This script will hyperlink from a feature in ArcMap to a filtered form in
'Microsoft Access. Works for me using ArcGIS 8.2, Access 2000, and Windows 2000.
'The following modifications were made:
' (1) the original script required that the Access form be open. I added code
' that will launch the database and form from a hard-coded location.
' (2) the original script passed a number variable from ArcMap to Access. I
' modified the SQL statement to accomodate strings which required using Chr(34)
' to represent ASCII character for double quotes. SQL requires strings
' to be in quotation marks.
' (3) comments were added to (hopefully) make using the script a little
' easier.
'Import this module into ArcMap
' (1) Open VBE by selecting Tools|Macros|Visual Basic Editor
' (2) Select File|Import File and navigate and open AccessHyperlink.bas. This should
' add the module to the Project document(not the Normal document)
' (3) Select Tools|References and check the reference to 'Microsoft Access 9.0
' Object Library'
' (4) Replace "E:\bird.mdb" with the location and name of the database you want
' to use
' (2) Replace "e:\" with the drive letter so it is the same drive as (4)
' (3) Replace "frmLocation" with the name of the form you want to filter
' (4) Modify ("[LocationID]=" & Chr(34) & thestring & Chr(34)) - replace [LocationID] with
' with the name of the field you want to filter on. Note that you must use
' Chr(34) to represent double quotes if you are passing a string. You do not
' need it if you are passing a number.
' (5) Close VBE and return to ArcMap
' (6) Open the Layer Properties for the layer you want to hyperlink from and navigate
' to Display|Hyperlink
' (7) Check the box next to support hyperlinks and select the field you want to use.
' Select Macro and copy and paste Project.AccessHyperlink.Hyperlink into the box.
' Do not click Create.
' (8) Click OK to exit the Layer Properties window and try the hyperlink tool.
Declare Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation _
As String, ByVal lpFile As String, ByVal lpParameters _
As String, ByVal lpDirectory As String, ByVal nShowCmd _
As Long) As Long
Declare Function apiFindWindow Lib "User32" Alias "FindWindowA" _
(ByVal lpclassname As Any, ByVal lpCaption As Any) As Long
Global Const SW_SHOWNORMAL = 1
Sub Hyperlink(pLink, pLayer)
On Error GoTo eh:
Dim pHyperlink As IHyperlink
Set pHyperlink = pLink
Dim pFLayer As IFeatureLayer
Set pFLayer = pLayer
Dim thestring As String
thestring = pHyperlink.Link
Dim hwnd
Dim StartDoc
hwnd = apiFindWindow("OPUSAPP", "0")
'opens Microsoft Access database
StartDoc = ShellExecute(hwnd, "open", "E:\bird.mdb", "", "e:\", SW_SHOWNORMAL)
Dim Accapp As Access.Application
Set Accapp = GetObject("E:\bird.mdb")
Accapp.DoCmd.OpenForm "frmLocation", acNormal, , ("[LocationID]=" & Chr(34) & thestring & Chr(34))
Exit Sub
eh:
MsgBox "Something isn't working!"
End Sub
[img][/img][/u][u][/u][u][/u][u][i][/i][img][/img][u][/u]
- Anmelden oder Registieren, um Kommentare verfassen zu können
Gespeichert von uwelangehh am Di., 09.11.2004 - 10:55
Permalinkueber die LocationID kannst du deinen Datensatz identifizieren. Wenn dein Indexfeld nicht LocationID sondern ID heisst, dann musst du entsprechend [ID] schreiben. Die eckigen Klammern bedeuten an dieser Stelle nicht, dass die Angabe optional ist bzw. durch etwas anderes ersetzt werden sollen. Man setzt in ACCESS eckige Klammern grundsaetzlich um Feldnamen, vor allem, wenn sie besondere Zeichen (z. B. Leerzeichen) enthalten.
Gruss
Uwe
Gespeichert von Chrissie am Di., 09.11.2004 - 11:05
PermalinkGruss Christoph
Gespeichert von Marc Schablowski am Do., 11.11.2004 - 10:41
Permalinkwo hast Du das Script gefunden? Bisher habe ein Projekt in ArcView 3.x, das auf eine Access-Datenbank zugreift. Ich habe vor, das Projekt nun auch mit ArcGIS 8.x zu realisieren.
Verstehe ich das Script richtig und es wird aus ArcGIS ein bestimmter Datensatz in dem entsprechenden Accessformular dargestellt?
Mich würde zusätzlich auch interessieren, aus dem Accessformular auf das selektierte Feature in der Karte zu zoomen (bei ArcView 3.x geht beides über die DDE Schnittstelle).
Marc
Gespeichert von Gast am Mo., 15.11.2004 - 07:33
PermalinkDas script ist von der esri homepage. Per hyperlinkfunktion oeffnet es das entsprechende Accessformular, des selektierten Datensatzes. Klappt jetzt prima bei mir. Fuer die Zoomfunktion aus access hab ich leider keinen Rat :-((
Gruss Chrissie
Gespeichert von Gast am Fr., 19.11.2004 - 16:19
Permalink- du bastelst die zoomfunktion meinetwegen im visualbasic nach
- packst alles in ne activx dll
- implementierst noch in die dll (also in die klasse welche dann in der dll steht) den iddecommandhandler
jetzt nur noch die dll registrieren, entweder mit ner .reg datei in der die geweiligen clsid stehen oder mit dem component category manager (die component.exe oder so im arcgis verzeichnis)
nun kannst du deine funktionen per dde im gis aufrufen :D
solltest du nähere infos brauchen, meld dich doch mal per mail:
n.biedermann@gmx.de
viel erfolg!
Gespeichert von Gast am Fr., 19.11.2004 - 16:21
Permalinkn.biedermann@gmx.de
danke schonmal vorab!