M
Michael Banks
Hello,
I am having problems trying to create a subform for each record in a
given recordset.
I am able to count up the number in a given recordset but I can't seem
to be able to create a subfrm for each record.
My subfrm contains a picture and a check box. The code I have working
right now is as follows:
Private Sub cboGLN_AfterUpdate()
Dim i As Long
Dim k As String
Dim subfrmPhotoName As String
Dim subfrm As Form
Dim rsCount As Integer
Dim subfrmTop As Long
Dim subfrmLeft As String
Me!txtRecordSetCount = ""
Set rs = Me.subfrmPhoto.Form.RecordsetClone
Me![txtRecordSetCount] = rs.RecordCount
subfrmLeft = "0.2083"
Debug.Print "subfrmleft is " & subfrmLeft
While rsCount <= rs.RecordCount
Debug.Print "rsCount is " & rsCount
Debug.Print "subfrmTop is " & subfrmTop
Debug.Print "subfrmPhotoName is " & subfrmPhotoName
If rsCount = 0 Then
rsCount = 1
subfrmPhotoName = "subfrmPhoto1"
Else
rsCount = rsCount + 1
subfrmPhotoName = "subfrmPhoto" & rsCount
End If
If subfrmTop = 0 Then
subfrmTop = 1
Else
subfrmTop = subfrmTop + 3
End If
k = DLookup("Location", "dbo_tblFormData", "GLN = '" &
cboGLN & "'")
i = InStr(1, k, cboGLN)
i = i + 13
Dim j As String
j = left(k, i)
' subfrmPhotoName.RecordSource = "SELECT * from dbo_tblFormData
where [Location] like '" & j & "*'"
' CreateControl frmphoto, acImage, acDetail, cblGLN, txtLocation,
subfrmLeft, subfrmTop, 3, 2.25
Wend
End Sub
In the table "dbo_tblFormData" I have fields "GLN" and "Location". The
location is the specific network location of the picture file i.e.
"S:\GLN_Images\AmeritechAudit\068168_421874_2001_12_19_11_35_14.jpg"
and contained within that Location is the GLN. I use the DLookup to
find the GLN within the lovation. What I would like to do is to create
an image on each subfrm. Currently, without using any of this code I
can set the subfrm as a single form and can use the navigation buttons
to cycle through the pictures. So somewhere Access is able to determine
that I have many pictures for each GLN, however if I set the subfrom to
a continuous form I will just get the first picture repeated over and
over. There must be a way to change that property. Can anyone offer up
any thoughts?
Thanks for your help, sorry for the lenghly confusing explanation.
I can clarify if need be
Mike
I am having problems trying to create a subform for each record in a
given recordset.
I am able to count up the number in a given recordset but I can't seem
to be able to create a subfrm for each record.
My subfrm contains a picture and a check box. The code I have working
right now is as follows:
Private Sub cboGLN_AfterUpdate()
Dim i As Long
Dim k As String
Dim subfrmPhotoName As String
Dim subfrm As Form
Dim rsCount As Integer
Dim subfrmTop As Long
Dim subfrmLeft As String
Me!txtRecordSetCount = ""
Set rs = Me.subfrmPhoto.Form.RecordsetClone
Me![txtRecordSetCount] = rs.RecordCount
subfrmLeft = "0.2083"
Debug.Print "subfrmleft is " & subfrmLeft
While rsCount <= rs.RecordCount
Debug.Print "rsCount is " & rsCount
Debug.Print "subfrmTop is " & subfrmTop
Debug.Print "subfrmPhotoName is " & subfrmPhotoName
If rsCount = 0 Then
rsCount = 1
subfrmPhotoName = "subfrmPhoto1"
Else
rsCount = rsCount + 1
subfrmPhotoName = "subfrmPhoto" & rsCount
End If
If subfrmTop = 0 Then
subfrmTop = 1
Else
subfrmTop = subfrmTop + 3
End If
k = DLookup("Location", "dbo_tblFormData", "GLN = '" &
cboGLN & "'")
i = InStr(1, k, cboGLN)
i = i + 13
Dim j As String
j = left(k, i)
' subfrmPhotoName.RecordSource = "SELECT * from dbo_tblFormData
where [Location] like '" & j & "*'"
' CreateControl frmphoto, acImage, acDetail, cblGLN, txtLocation,
subfrmLeft, subfrmTop, 3, 2.25
Wend
End Sub
In the table "dbo_tblFormData" I have fields "GLN" and "Location". The
location is the specific network location of the picture file i.e.
"S:\GLN_Images\AmeritechAudit\068168_421874_2001_12_19_11_35_14.jpg"
and contained within that Location is the GLN. I use the DLookup to
find the GLN within the lovation. What I would like to do is to create
an image on each subfrm. Currently, without using any of this code I
can set the subfrm as a single form and can use the navigation buttons
to cycle through the pictures. So somewhere Access is able to determine
that I have many pictures for each GLN, however if I set the subfrom to
a continuous form I will just get the first picture repeated over and
over. There must be a way to change that property. Can anyone offer up
any thoughts?
Thanks for your help, sorry for the lenghly confusing explanation.
I can clarify if need be
Mike