A
Angeline
Hello,
I have a form which comprises of a multi-select List Box bound to a table
and a sub-form bound to a query. When the user selects in the list box the
results of the query appear in the subform (very useful thanks Duane Hookom).
The problem that I have is that I need to be able to get the results into
either a table but ultimately into a report so that the user can print off
their results in a specific layout. However once the form is closed the query
is reset. Can someone please tell me this is possible and provide some
direction as to how. The module code iwhich the query uses is below:
Function IsSelectedVar( _
strFormName As String, _
strListBoxName As String, _
varValue As Variant) _
As Boolean
'strFormName is the name of the form
'strListBoxName is the name of the listbox
'varValue is the field to check against the listbox
Dim lbo As ListBox
Dim item As Variant
If IsNumeric(varValue) Then
varValue = Trim(Str(varValue))
End If
Set lbo = Forms(strFormName)(strListBoxName)
For Each item In lbo.ItemsSelected
If lbo.ItemData(item) = varValue Then
IsSelectedVar = True
Exit Function
End If
Next
End Function
I have a form which comprises of a multi-select List Box bound to a table
and a sub-form bound to a query. When the user selects in the list box the
results of the query appear in the subform (very useful thanks Duane Hookom).
The problem that I have is that I need to be able to get the results into
either a table but ultimately into a report so that the user can print off
their results in a specific layout. However once the form is closed the query
is reset. Can someone please tell me this is possible and provide some
direction as to how. The module code iwhich the query uses is below:
Function IsSelectedVar( _
strFormName As String, _
strListBoxName As String, _
varValue As Variant) _
As Boolean
'strFormName is the name of the form
'strListBoxName is the name of the listbox
'varValue is the field to check against the listbox
Dim lbo As ListBox
Dim item As Variant
If IsNumeric(varValue) Then
varValue = Trim(Str(varValue))
End If
Set lbo = Forms(strFormName)(strListBoxName)
For Each item In lbo.ItemsSelected
If lbo.ItemData(item) = varValue Then
IsSelectedVar = True
Exit Function
End If
Next
End Function