Exif and Access queries

Thank you.
My report looks like this. Every picture I have picture and url to high quality picture.
I want to add also link to GPS coordinates below it - just to open maps google with coordinates.
All my report is based on query where I download temporary pictures from url etc. And it is reason why I want to do it by public function. To add Cordinates1 url, coordinates2 url, below every picture and direct link to them.

I try to do something like this:

Code:
Public Function openGPS(filePath1 As String)

On Error GoTo ExifError
    
    

        
    With GPSExifReader.OpenFile(filePath1)
        If .GPSLatitudeDecimal > 0 Then
                                   
        Me.Value = "http://maps.google.com/maps?ll=" & Replace(.GPSLatitudeDecimal, ",", ".") & "," & Replace(.GPSLongitudeDecimal, ",", ".") & "&spn=0.03,0.03&t=m&q=" & Replace(.GPSLatitudeDecimal, ",", ".") & "," & Replace(.GPSLongitudeDecimal, ",", ".")
        Else
        Me.Value = "No GPS"
        End If
    End With
    
    Exit Function
    
ExifError:
    MsgBox "error"


End Function
This code of course is wrong. But if it works I will put in query field coordinates1 url: openGPS([table1].[fileLocalization]) and I will do it for 2,3... etc. And if picture will be empty I will do in query iif([table1].[fileLocalization10] is null; "";openGPS([table1].[fileLocalization10])
Maybe it is not logical, but I don't know how to do it differently.

Many thank's for help.
Karol
 

Attachments

  • report.jpg
    report.jpg
    83.3 KB · Views: 183
I use Exif In my picture library Make sure the location is correct This is the code I use to save the cords
Picture Library
This will check for a jpg image

Code:
Dim C As Long
Dim sngLat As Double, sngLong As Double, sngAlt As Double
'On Error GoTo HandleErr
On Error Resume Next

    If GetExtenstion(Me![Stored]) = "jpg" And IsNothing(Me.txtLatitude) Then
    With GPSExifReader.OpenFile(DLookup("FolderLocation", "tblPreferences") & Me![Stored])
        sngAlt = .GPSAltitudeDecimal
        sngLat = .GPSLatitudeDecimal
        sngLong = .GPSLongitudeDecimal
    End With
        If Not IsNothing(sngLat) Then
            Me.txtAltitude = Nz(sngAlt, 0)
            Me.txtLatitude = Nz(sngLat, 0)
            Me.txtLongitude = Nz(sngLong, 0)
        End If
    End If

I think I remember trying to Use this Replace(.GPSLatitudeDecimal, ",", ".") But t wouldn't work for me so assign the result to a varible.
 
Last edited:
Hi Guys,

thank you for all hint's and suggestions.
I did what I want 🥳
Code:
Public Function mapaGoogle(ByVal plik As Variant)
Dim Mapa As String
    With GPSExifReader.OpenFile(plik)
        If .GPSLatitudeDecimal > 0 Then
        mapaGoogle = "http://maps.google.com/maps?ll=" & Replace(.GPSLatitudeDecimal, ",", ".") & "," & Replace(.GPSLongitudeDecimal, ",", ".") & "&spn=0.03,0.03&t=m&q=" & Replace(.GPSLatitudeDecimal, ",", ".") & "," & Replace(.GPSLongitudeDecimal, ",", ".")
        Else
        mapaGoogle = "błąd GPS"
     End If
    End With

End Function

Colin I will analyze your solution during free time and maybe I will provide print screen of map in my reports. But I have to think how to put there and that will be size of it.
 

Users who are viewing this thread

Back
Top Bottom