View Single Post
  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Database Field SQL Statement

OK, so let's be clear this works OK?

DATABASE \d "C:\\Temp\\VerizonAirCard.mdb" \c "DSN=MS Access
Database;DBQ=
C:\\Temp\\VerizonAirCard.mdb;DefaultDir= C:\\Temp;DriverId=25;FIL=MS
Access;MaxBufferSize=2048;PageTimeout=5;UID=admin; " \s "SELECT * FROM
'tblAirCard' "


Does this work OK?

DATABASE \d "C:\\Temp\\VerizonAirCard.mdb" \s "SELECT * FROM tblAirCard'"

NB, in most cases backquotes (which is what you have around your table name)
can be replaced by [], e.g.

DATABASE \d "C:\\Temp\\VerizonAirCard.mdb" \c "DSN=MS Access
Database;DBQ=
C:\\Temp\\VerizonAirCard.mdb;DefaultDir= C:\\Temp;DriverId=25;FIL=MS
Access;MaxBufferSize=2048;PageTimeout=5;UID=admin; " \s "SELECT * FROM
[tblAirCard]"


but not by straight quotes, e.g.

DATABASE \d "C:\\Temp\\VerizonAirCard.mdb" \c "DSN=MS Access
Database;DBQ=
C:\\Temp\\VerizonAirCard.mdb;DefaultDir= C:\\Temp;DriverId=25;FIL=MS
Access;MaxBufferSize=2048;PageTimeout=5;UID=admin; " \s "SELECT * FROM
'tblAirCard'"


Is tblAirCard a table in the .mdb or a linked table?

Peter Jamieson


"mico" wrote in message
news
PS Even after eliminating the connect string, \c parameter, I still need
the
tic marks around the table name for the Database statement to work,
otherwise
I get the unable to open data source.

"mico" wrote:

OS: XP Pro SP1, Word 2003 SP2

DATABASE \d "C:\\Temp\\VerizonAirCard.mdb" \c "DSN=MS Access
Database;DBQ=
C:\\Temp\\VerizonAirCard.mdb;DefaultDir= C:\\Temp;DriverId=25;FIL=MS
Access;MaxBufferSize=2048;PageTimeout=5;UID=admin; " \s "SELECT * FROM
'tblAirCard' "

Ive been unable to change the select statement above to work properly.
Ive tried to use tic, backslash and tic and backslash to denote the
columns
names and Ive tried using the tablename.fieldname, tablename!fieldname
and
just the field name by itself and everything generates the generic Word
error
unable to open data source. Any advice is appreciated.