G
golfdog via AccessMonster.com
Have a form with two subforms. Attempting to generate a email message off the
form. So far am successful with the main form data being built into the email
body, now trying to loop through the related records from the subforms as
they can have multiple related records to the main form and include that in
the email message body.
I am throwing an error on this part of the code.....
' Groups Detail
' This routine loops through all the group details which belong to this
particular request
Set RSGroupQry = CurrentDb.QueryDefs("q_ReqGrp")
Set RSGroups = RSGroupQry.OpenRecordset()
RSGroupQry.Parameters("ReqNo") = Me!ReqNo
lngRSGroupsCount = RSGroups.RecordCount
If lngRSGroupsCount = 0 Then
strBody = strBody & "No Groups Associated With This Request" & vbCrLf &
vbCrLf
Else
RSGroups.MoveFirst
Do Until RSGroups.EOF
strGroupsText = RSGroups!GrpType & " " & RSGroups!Grp
strBody = strBody & strGroupsText & vbCrLf
RSGroups.MoveNext
Loop
Appreciate it.
RSGroups.Close
Set RSGroups = Nothing
End If
form. So far am successful with the main form data being built into the email
body, now trying to loop through the related records from the subforms as
they can have multiple related records to the main form and include that in
the email message body.
I am throwing an error on this part of the code.....
' Groups Detail
' This routine loops through all the group details which belong to this
particular request
Set RSGroupQry = CurrentDb.QueryDefs("q_ReqGrp")
Set RSGroups = RSGroupQry.OpenRecordset()
RSGroupQry.Parameters("ReqNo") = Me!ReqNo
lngRSGroupsCount = RSGroups.RecordCount
If lngRSGroupsCount = 0 Then
strBody = strBody & "No Groups Associated With This Request" & vbCrLf &
vbCrLf
Else
RSGroups.MoveFirst
Do Until RSGroups.EOF
strGroupsText = RSGroups!GrpType & " " & RSGroups!Grp
strBody = strBody & strGroupsText & vbCrLf
RSGroups.MoveNext
Loop
Appreciate it.
RSGroups.Close
Set RSGroups = Nothing
End If