![]() You get a maximum of either 255 or around 511 characters in the SQL statement, and Word tends to impose some syntax requirements that Transact-SQL does not, so e.g. SQLStatement1:="put the second part in here" SQLStatement:="put your SQL statement in here, and if it is long.", _ Let's say it is called "c:\a\myodc.odc" Then in VBA you can use something likeĪctiveDocument.OpenDataSource Name:="c:\a\myodc.odc, _ ![]() needed to connect to the correct server and database. odc (Office Data Connection file) which has the info. You either have to be able to create a View in SQL Server that performs the query you need, then connect to that, or you have to be able to create the correct query manually (or perhaps using some other query tool that can help you), then use VBA to connectįor example, if you have been through the connection process once (connecting to a single table) then you will have a. Word and the current data source dialog do not really give you any help with that.
0 Comments
Leave a Reply. |