Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is this possible? (VB.net/Excel) 1

Status
Not open for further replies.

lisalis99

Programmer
Jan 9, 2005
121
US
Is it possible to create a vb.net app that allows a user to choose fields from a database and then export them to excel? I know there are tons of ways to export to excel, but how can the user choose the fields from the DB they want to export?

Thanks,
Lisa
 
Hi- Do I need to put it around the " & sFields & " or elsewhere? Thanks...
 
No... you are going to have to add it into here:
Code:
        For Each item In ListBox2.Items
            If item.Selected = True Then
                '--Note: if item.Value doesn't work use item.Text
                [red]sFields += "[" & item.Value & "], "[/red]
            End If
        Next

And then change this:
Code:
        If sFields.Length > 2 Then
            [red]sFields = sFields.Substring(0, (sFields.Length - 3))[/red]
        End If

Senior Software Developer
 
SORRY.... AGAIN!!! Ahhhgg!

Forget that last part!

Just do the First Change!

The second one would have stripped out the "]" and we still need that or another SQL error will crop up.

Senior Software Developer
 
Oh Duh- I should have known that one... thanks again... works like a charm...

Once again, thank you for your dedication in helping me out- I do appreciate it, you're awesome!

Lisa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top