View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.word.vba.general
Peter Jamieson[_3_] Peter Jamieson[_3_] is offline
external usenet poster
 
Posts: 4
Default SELECT UNIQUE some_column FROM MAILMERGE.DATASOURCE

because Word can only deal with the 5 WHERE conditions its dialog
supports, and so on


ah! And I thought I could overcome that limitation which I imagined
to be only in the dialog, not in Word's SQL client.


Yes, AFAIK the limitation is only in the dialog box - i.e. you can issue the
SQL, and it should work, but my comment was really related to your point
about

"but I don't know if this can be done without
confusing MS-Word's Mailmerge process"

because as soon as you start letting the user change the conditions, or
save/re-open Word documents with data sources attached, Word /may/ object.
So it depends on what you consider to be part of Word's Mailmerge process.

FWIW, when connecting to a data source, Word uses the SQL interpreter
associated with that data source. If the data source is a Word document, or
something that Word would typically read with an internal converter (e.g.
..rtf) or external converter (e.g. the old Excel converter), Word uses a very
simple internal SQL dialect which basically reflects the capabilities of the
Query Options dialog in the Insert Database function (i.e. you can select
columns and do a small number of filters and sorts). When Word connects to
Excel via OLEDB or ODBC, it uses the Jet Engine's SQL interpreter.

If you were talking about marking a single contiguous block of Excel
cells,
you might be able to retrieve your data from a named range, but you're
not
doing that.


Maybe I should try that. Working on the Excel sheet thru VBA, using
the Excel Application-Object.


From the SQL point of view that should work, but only when the range has
column headers - in essence you do a SELECT * FROM `rangename` . Also, I
think "rangename" has to be a range /name/ - I don't think anything like
FROM `Sheet1!R1C1:R3C3` or `Sheet1:A1:C3` works.

It seems to me that Jet SQL will be enough to get the right records and
columns, but it is more difficult to overcome the problems it has with
variable data types in Excel.

Peter Jamieson


"Lüko Willms" wrote in message
...
Am Mon, 13 Nov 2006 16:35:09 UTC, schrieb "Peter Jamieson"
auf
microsoft.public.word.vba.general :

I don't think there's anything really slick you could do in Excel to
help.


Thanks a lot for all your comments.

Well, I try to abuse Excel as a database system, because at that
place where I am, I have only Excel and Word available. Just testing
out the limits...

because Word can only deal with the 5 WHERE conditions its dialog
supports, and so on


ah! And I thought I could overcome that limitation which I imagined
to be only in the dialog, not in Word's SQL client.

If you were talking about marking a single contiguous block of Excel
cells,
you might be able to retrieve your data from a named range, but you're
not
doing that.


Maybe I should try that. Working on the Excel sheet thru VBA, using
the Excel Application-Object.


Yours,
L.W.