problem with picture load on form b/c pathname size

  • Thread starter Thread starter reservedbcreater
  • Start date Start date
R

reservedbcreater

using pictureload2k i embedded that code into my DB. it works fine other
than my previous post and this one:
i cant select pictures with long pathnames..
ie. i cant use pics from my documents but if i put the same pic in C:\ it
works
when i choose a pic from my documents or other fodlers > i get an error >
text is too long to be edited
 
maybe its not my code for the form but for the module which i copy and
pasted from rogersaccess library pictureload2k to make a module in mine.


Option Compare Database
Option Explicit
Dim Filename As String, Filename1 As String, pathname As String

Private Sub Form_Activate()
pathname = "C:\Pics\"
End Sub

Private Sub Form_Current()
On Error GoTo Err_cmdClose_Click

'set the picture path
Me.ImgStock.Picture = Me.txtStockGraph


Exit_cmdClose_Click:
Exit Sub

Err_cmdClose_Click:
If Err.Number = 2220 Then 'can't find the file
Resume Next
ElseIf Err.Number = 94 Then 'invalid use of null
Me.ImgStock.Picture = ""

Resume Next
Else
MsgBox Err.Description
Resume Exit_cmdClose_Click
End If
End Sub



Private Sub Form_BeforeUpdate(Cancel As Integer)

Dim intResponse As Integer

intResponse = MsgBox("Save Record?", vbYesNoCancel)

Select Case intResponse
Case vbYes
'Do Nothing
Case vbNo
Me.Undo 'To undo the edit
Case vbCancel
Cancel = True 'To cancel the update & hence the close
End Select

End Sub
Private Sub Cmd75_Click()
On Error GoTo Err_Cmd75_Click

Dim strDocName As String
Dim strID As String


strDocName = "Edit: Water"

DoCmd.Close
DoCmd.OpenForm strDocName




Exit_Cmd75_Click:
Exit Sub

Err_Cmd75_Click:
MsgBox Err.Description
Resume Exit_Cmd75_Click

End Sub

Private Sub cmdChooseAFile_Click()
On Error GoTo Err_cmdChooseAFile_Click
Dim strFilter As String
Dim lngFlags As Long
strFilter = ahtAddFilterItem(strFilter, "Picture Formats (*.jpg
*.jpeg, *.bmp, *.gif)", "*.jpg; *.jpeg; *.bmp; *.gif")
'MsgBox "You selected: " &
Filename = ahtCommonFileOpenSave(InitialDir:=pathname, _
Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
DialogTitle:="Select Picture File")
'display picture
Me.txtStockGraph = Filename
Me.ImgStock.Picture = Filename

Exit_cmdChooseAFile_Click:
Exit Sub

Err_cmdChooseAFile_Click:
MsgBox Err.Description
Resume Exit_cmdChooseAFile_Click

End Sub

Private Sub cmdChooseAFile1_Click()
On Error GoTo Err_cmdChooseAFile1_Click
Dim strFilter As String
Dim lngFlags As Long
strFilter = ahtAddFilterItem(strFilter, "Picture Formats (*.jpg
*.jpeg, *.bmp, *.gif)", "*.jpg; *.jpeg; *.bmp; *.gif")
'MsgBox "You selected: " &
Filename1 = ahtCommonFileOpenSave(InitialDir:=pathname, _
Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
DialogTitle:="Select Picture File")
'display picture
Me.txtStockGraph1 = Filename1
Me.ImgStock1.Picture = Filename1

Exit_cmdChooseAFile1_Click:
Exit Sub

Err_cmdChooseAFile1_Click:
MsgBox Err.Description
Resume Exit_cmdChooseAFile1_Click

End Sub
 
Back
Top