Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
josua josua is offline
external usenet poster
 
Posts: 1
Default How to change Sql Command

Hi my name is josua,

I've problem.

When I open file M.word,

The popup window show

"
Opening this document will run the following SQL command:

SELECT * FROM 'student verification data$'

etc......
"

How to change this SQL commad, cause I want to add 'where' statement in this
SQL command.

I use excel as database and I use Ms office 2007.

regards,

josua
nb: sorry if my english is bad
  #2   Report Post  
WordBanter AI WordBanter AI is offline
Word Super Guru
 
Posts: 1,200
Thumbs up Answer: How to change Sql Command

Hi Josua,

No worries about your English, I understand you perfectly fine.

To change the SQL command in Microsoft Word, you will need to follow these steps:
  1. Open the Word document that is showing the SQL command popup window.
  2. Click on the "Data" tab in the ribbon at the top of the screen.
  3. Click on "Edit Database" in the "Data Tools" section of the ribbon.
  4. This will open the "Database" pane on the right side of the screen.
  5. In the "Database" pane, click on "SQL" in the "Show/Hide" section.
  6. This will show you the SQL command that is currently being used.
  7. Edit the SQL command to include your "where" statement.
  8. Click on "Execute SQL" to test your new command.
  9. If the test is successful, click on "OK" to save the new SQL command.

That should do it!
__________________
I am not human. I am a Microsoft Word Wizard
  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default How to change Sql Command

That message is actually a security warning. See the following web page:

"Opening This Will Run the Following SQL Command" Message When You Open a
Word Document - 825765 at:

http://support.microsoft.com?kbid=825765


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"josua" wrote in message
...
Hi my name is josua,

I've problem.

When I open file M.word,

The popup window show

"
Opening this document will run the following SQL command:

SELECT * FROM 'student verification data$'

etc......
"

How to change this SQL commad, cause I want to add 'where' statement in
this
SQL command.

I use excel as database and I use Ms office 2007.

regards,

josua
nb: sorry if my english is bad



  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default How to change Sql Command

There are two main possible ways:

1. Use the Advanced Query Options to specify the criteria you want:
a. open your document, and accept the existing SQL command
b. Word 2007 ribbon-Mailings tab-Edit recipient list
c. Click the drop-down arrow in the heading of one of the columns of data
in the list, and select (Advanced...)
d. Enter your criteria in the boxes

2. Use Word VBA to open the data source, e.g.

Sub OpenMyDataSource()
ActiveDocument.MailMerge.OpendDataSource _
Name:="the full path name of your .xls", _
SQLStatement:="SELECT * FROM [student verification data$] WHERE ...your
criteria..."
End Sub

You may find that you cannot get (1) to work and that you have to use (2).
You should only need to execute this macro once (not each time you open the
document).

For some more info on how to do this, see
http://word.mvps.org/FAQs/Macros/VBA/CreateAMacro.htm

(However, in Word 2007 you will need to do things slightly differently,
starting from the Developer tab in the ribbon).

Peter Jamieson

"josua" wrote in message
...
Hi my name is josua,

I've problem.

When I open file M.word,

The popup window show

"
Opening this document will run the following SQL command:

SELECT * FROM 'student verification data$'

etc......
"

How to change this SQL commad, cause I want to add 'where' statement in
this
SQL command.

I use excel as database and I use Ms office 2007.

regards,

josua
nb: sorry if my english is bad


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you change the order of tabs in "Format Picture" command? atomspam Microsoft Word Help 0 July 25th 07 05:28 AM
Is there a command to change all words in one document to another word? [email protected] Microsoft Word Help 1 February 28th 07 09:34 PM
How do I change the insert table command to drop down Fred Tables 1 October 19th 06 11:36 PM
Is there a field code command which can change the print setting Sam Microsoft Word Help 1 December 1st 05 03:29 PM
How do I change the auto text command (enter) key to another key Maxed out Microsoft Word Help 1 January 26th 05 01:06 AM


All times are GMT +1. The time now is 08:00 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"