Results from Query using IsSelectVar to a Table

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
 
D

Duane Hookom

You leave the form with the list box on it open. Use a query similar to the
subform query as the record source for your report.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top