Dim StrLoc As String, StrTemp As String, PFolders As String
Dim TempPic As String, MainPic As String, StrDim As String
Dim Boo As Boolean
Dim LngWidth As Long, LngHeight As Long
Dim mArray() As String
On Error GoTo HandleErr
StrLoc = DLookup("FolderLocation", "tblPreferences") 'Store the main folders location
StrTemp = "Temp Pictures\" 'The place the picture will be copied to
PFolders = Left$(Me![Stored], InStrRev(Me![Stored], "\")) 'Find The Folder list in the stored location I.E. \Kylie\Pictures\
TempPic = Trim(CurrentProject.Path & "\" & Replace(Me![Stored], PFolders, StrTemp)) 'Setup the tempory location for the picture in local folder
MainPic = Trim(StrLoc & Me![Stored]) 'Set the location of the original location
If adhFileExists(MainPic) Then
'First Do 180 Into Temp folder
Boo = WIA_RotateImage(MainPic, TempPic, 180)
End If
'Now check for success If Boo=true Delete The Main Picture
'If Not True Get Out Add Msgbox code
If Not Boo Then Exit Sub
DeleteFile MainPic
Boo = False
If adhFileExists(TempPic) Then
'First Do 180 Into Temp folder
Boo = WIA_RotateImage(TempPic, MainPic, 180)
End If
'Now Update The Picture PS you don't really need this but if theirs a probem It will show here
Me![Pic].Picture = MainPic
'Delete Temp Picture
If Not Boo Then Exit Sub
DeleteFile TempPic
'Now Get The Dimensions and calc the Orientation
StrDim = GetDimensions(MainPic)
mArray = Split(StrDim, "x")
LngWidth = CLng(Trim(mArray(0)))
LngHeight = CLng(Trim(mArray(1)))
'Update The Field
Me![Orientation] = StrDim
'Now Comes the Portate/landscape
If LngHeight > LngWidth Then
Me![Orientation] = "Portrait"
'Their is a very slight chance they will be same so do this
Else
Me![Orientation] = "Landscape"
End If
HandleExit:
Exit Sub
HandleErr:
Select Case Err.Number
Case Else
MsgBox Err.Number & vbCrLf & Err.Description
Resume HandleExit
Resume
End Select