Good day!

Is there a way to make the data report to show only the fields selected by the user?
I have a form where the user can select the fields(from ms access table) in the list box(checkbox enabled) to show in data report. The total fields is almost 50. When the user check/selects only 10 fields, then that will be the fieds to show in the data report. I need any idea to make it like this dynamically.

Thank you!

Create the SQL Statement by concatinate the field names, which theuser selected.

        Dim xStr As String = "Select "
        For i As Integer = 0 To ListBox1.SelectedItems.Count - 1
            xStr &= ListBox1.SelectedItems(i)
            If i < ListBox1.SelectedItems.Count - 1 Then
                xStr &= ", "
            End If
        Next
        xStr &= " From Table1"

Suppose, it can help you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.