H
hquan
Any help would be appreciated. I have a user defined type that stores information about various pictures in an array. I also have a form that displays 12 pictures at a time. Everything works great - however, when I close the form, it also closes Access. The behavior is very consistant and predictable - and the ldb file isn't deleted, leading me to believe that Access actually crashes. Any thoughts? Note, I'm not actually loading the picture into the udt - just the path and other info
here's the udt
Public Type udtPhotoDat
strPath As Strin
dtDate As Dat
lngSize As Lon
strPicType As String 'jpeg, gif, et
strFileName As Strin
strNewFileName As Strin
strOldFileName As Strin
blnModified As Boolea
blnSelected As Boolea
strCopyToPath As Strin
strCtlName As Strin
strStepTaken As Strin
intPicSet As Intege
blnPicSaved As Boolea
End Typ
The code that loads the udt array - loads the info for all pics in a directory
Private Sub LoadPicVar(
'load the data into the pic variable
'load all pics in the folde
Dim strPicFile As Strin
Dim intGrouping As Integer 'if the group number - so that only the # of pics in intgrpsize is show
Dim intGrpCount As Integer 'track # of items added to a grou
Dim strGrpNumbers As Strin
Dim intTop As Integer 'the maximum number of pics in a folde
intcounter = -
intGrouping = -
intTop = FileCt(conPhotoPath
ReDim phPics(intTop
strPicFile = Dir(conPhotoPath, vbNormal
D
intGrouping = intGrouping +
strGrpNumbers = strGrpNumbers & intGroupin
For intGrpCount = 1 To conGrpSiz
intcounter = intcounter +
With phPics(intcounter
.strPath = conPhotoPath & strPicFil
.dtDate = FileDateTime(.strPath
.strFileName = strPicFil
.strCtlName = "image" & intcounte
.intPicSet = intGroupin
End Wit
'If intcounter = (intTop - 1) Then Exit D
strPicFile = Di
If strPicFile = "" Then Exit D
Nex
strGrpNumbers = strGrpNumbers & ";
Loo
Me.Parent.lstGroup.RowSource = strGrpNumber
Me.Parent.lstGroup.Value = Me.Parent.lstGroup.ItemData(0
End Su
code to load the pictures in the form - loads into image object
Public Sub LoadPics(intGrp As Integer, Optional blnUnload As Boolean
'load all pics in the the specified group to the for
Dim intStartNum As Intege
DoCmd.Hourglass Tru
intStartNum = (intGrp * conGrpSize
For intcounter = 0 To (conGrpSize - 1
'intcounter = intcounter +
If (intStartNum + intcounter) >= UBound(phPics) Or blnUnload = True The
Me.Controls("image" & intcounter).Picture = "(none)
Me.Controls("txtPicName" & intcounter).Value = Nul
Els
With phPics(intStartNum + intcounter
Me.Controls("image" & intcounter).Picture = .strPat
Me.Controls("txtpicname" & intcounter).Tag = intStartNum + intcounte
If .blnModified = True The
Me.Controls("txtPicName" & intcounter).Value = .strNewFileNam
Me.Controls("image" & intcounter).BorderStyle =
Me.Controls("image" & intcounter).BorderColor = conRedBorde
Me.Controls("txtpicname" & intcounter).BorderStyle =
Me.Controls("txtpicname" & intcounter).BorderColor = conRedBorde
Els
Me.Controls("image" & intcounter).BorderStyle =
If .blnPicSaved = True The
Me.Controls("txtPicName" & intcounter).Value = "SAVED
Me.Controls("txtPicName" & intcounter).Enabled = Fals
Els
Me.Controls("txtPicName" & intcounter).Enabled = Tru
Me.Controls("txtPicName" & intcounter).Value = .strFileNam
End If
Me.Controls("image" & intcounter).BorderColor = conBlueBorder
Me.Controls("txtpicname" & intcounter).BorderStyle = 0
Me.Controls("txtpicname" & intcounter).BorderColor = conBlueBorder
End If
End With
End If
Next
DoCmd.Hourglass False
End Sub
Thanks in advance!
-hnq51834
here's the udt
Public Type udtPhotoDat
strPath As Strin
dtDate As Dat
lngSize As Lon
strPicType As String 'jpeg, gif, et
strFileName As Strin
strNewFileName As Strin
strOldFileName As Strin
blnModified As Boolea
blnSelected As Boolea
strCopyToPath As Strin
strCtlName As Strin
strStepTaken As Strin
intPicSet As Intege
blnPicSaved As Boolea
End Typ
The code that loads the udt array - loads the info for all pics in a directory
Private Sub LoadPicVar(
'load the data into the pic variable
'load all pics in the folde
Dim strPicFile As Strin
Dim intGrouping As Integer 'if the group number - so that only the # of pics in intgrpsize is show
Dim intGrpCount As Integer 'track # of items added to a grou
Dim strGrpNumbers As Strin
Dim intTop As Integer 'the maximum number of pics in a folde
intcounter = -
intGrouping = -
intTop = FileCt(conPhotoPath
ReDim phPics(intTop
strPicFile = Dir(conPhotoPath, vbNormal
D
intGrouping = intGrouping +
strGrpNumbers = strGrpNumbers & intGroupin
For intGrpCount = 1 To conGrpSiz
intcounter = intcounter +
With phPics(intcounter
.strPath = conPhotoPath & strPicFil
.dtDate = FileDateTime(.strPath
.strFileName = strPicFil
.strCtlName = "image" & intcounte
.intPicSet = intGroupin
End Wit
'If intcounter = (intTop - 1) Then Exit D
strPicFile = Di
If strPicFile = "" Then Exit D
Nex
strGrpNumbers = strGrpNumbers & ";
Loo
Me.Parent.lstGroup.RowSource = strGrpNumber
Me.Parent.lstGroup.Value = Me.Parent.lstGroup.ItemData(0
End Su
code to load the pictures in the form - loads into image object
Public Sub LoadPics(intGrp As Integer, Optional blnUnload As Boolean
'load all pics in the the specified group to the for
Dim intStartNum As Intege
DoCmd.Hourglass Tru
intStartNum = (intGrp * conGrpSize
For intcounter = 0 To (conGrpSize - 1
'intcounter = intcounter +
If (intStartNum + intcounter) >= UBound(phPics) Or blnUnload = True The
Me.Controls("image" & intcounter).Picture = "(none)
Me.Controls("txtPicName" & intcounter).Value = Nul
Els
With phPics(intStartNum + intcounter
Me.Controls("image" & intcounter).Picture = .strPat
Me.Controls("txtpicname" & intcounter).Tag = intStartNum + intcounte
If .blnModified = True The
Me.Controls("txtPicName" & intcounter).Value = .strNewFileNam
Me.Controls("image" & intcounter).BorderStyle =
Me.Controls("image" & intcounter).BorderColor = conRedBorde
Me.Controls("txtpicname" & intcounter).BorderStyle =
Me.Controls("txtpicname" & intcounter).BorderColor = conRedBorde
Els
Me.Controls("image" & intcounter).BorderStyle =
If .blnPicSaved = True The
Me.Controls("txtPicName" & intcounter).Value = "SAVED
Me.Controls("txtPicName" & intcounter).Enabled = Fals
Els
Me.Controls("txtPicName" & intcounter).Enabled = Tru
Me.Controls("txtPicName" & intcounter).Value = .strFileNam
End If
Me.Controls("image" & intcounter).BorderColor = conBlueBorder
Me.Controls("txtpicname" & intcounter).BorderStyle = 0
Me.Controls("txtpicname" & intcounter).BorderColor = conBlueBorder
End If
End With
End If
Next
DoCmd.Hourglass False
End Sub
Thanks in advance!
-hnq51834