I'm brand new at my job and I'm trying to get hired on here, so it makes me extra nervous if I can't figure this out.

My boss has asked me to automate his reports he gets through a combination of access and excel. I say, "Sure, no problem." I get started on it (being fairly new to VBA and very new to Access) and I am starting quick. Right of the bat, learned a ton of important functions. He needs me to have a button to choose a db to show. Easy, just created a button and saved it to a variable.

Next, he needs me to run a bunch of his Microsoft Access Macros through Excel. Also, no problem. Just told it to open the Access File with a ".OpenCurrentDatabase" run the macros with ".DoCmd.RunMacro" and close it with ".CloseCurrentDatabase & .Quit."

Now he needs me to display some of his queries on Excel. I'm thinking sure, no problem. I tell it to connect to the database with some "ADODB.Connection" because it's a accdb file. Test out some SQL statements with:

VB:
Set cn = New ADODB.Connection
With cn
.Provider = "Microsoft.ACE.OLEDB.12.0"
.Open MyConn
Set rs = .Execute(sSQL)
End With

Formatting tags added by mark007
The simple statements work fine and show up nice and neatly. Although, I've hit a snag and I need some outside help. The SQL statements he has in his queries are insanely long and complex. They won't show up through this process. After spending over an hour trying to format the length in a string (because VB has a line limit, so you have to do a lot of &'s), I finally get it to run without a syntax error. But now I get an error saying It's returning 0 queries. I know for a fact it's not returning 0 queries, we run it all the time. It's just that I don't think excel can handle a statement 20 lines long without syntax errors.

Let me know if there is a way to do this please

Cross-Thread: What's the best approach: Need multiple queries displayed on Excel on the same page