Kirjaudu sisään Microsoft-tilillä
Kirjaudu sisään tai luo tili.
Hei,
Käytä toista tiliä.
Sinulla on useita tilejä
Valitse tili, jolla haluat kirjautua sisään.
englanti
Olemme pahoillamme. Tämä artikkeli ei ole saatavilla tällä kielellä.

Symptoms

When you try to use Microsoft Query to return data from some third-party databases into Microsoft Excel, apostrophes (') around alias names can cause the query to fail. The error message that you receive depends on the data source that you use.

Cause

This behavior is the result of a design change in Microsoft Query. Apostrophes are now automatically used when aliasing, to prevent errors that are caused by an alias that contains spaces or reserved words.

Resolution

A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem.

If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, submit a request to Microsoft Customer Service and Support to obtain the hotfix.

Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=supportNote The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.

Excel 2003 and Excel 2007

You do not have to download anything to fix this problem in Microsoft Office Excel 2003 or in Microsoft Office Excel 2007. See the "More Information" section of this article for instructions about how to enable this functionality

Excel 2002

The global Excel 2002 version of this hotfix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.

File name

File size

Date

Time

Msqry32.msp

2,100,760

24-Sep-2002

01:29

Msqry32_admin.msp

1,331,424

24-Sep-2002

03:52

After the hotfix is installed, the following files will have the listed attributes or later:

File name

File version

File size

Date

Time

Msqry32.exe

10.0.4510.0

739,912

13-Sep-2002

03:52

Excel 2000

The global Excel 2000 version of this hotfix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.

File name

File size

Date

Time

Msqry32.msp

1,166,692

08-Nov-2002

13:41

Msqry32_admin.msp

1,419,628

08-Nov-2002

16:36

After the hotfix is installed, the following files will have the listed attributes or later:

File name

File version

File size

Date

Time

Msqry32.exe

9.0.0.6919

1,089,536

19-Sep-2002

20:31

After you install this hotfix, follow the steps that are listed in the "More Information" section of this article to set the AllowAlias registry key and to activate the hotfix.

Note After you install the fix that is described in this article, and set the AllowAlias registry key, Microsoft Query will behave as it did in Excel 97.


Workaround

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.

To work around this issue, add quotation marks to the alias from inside Microsoft Query. To do this, follow these steps:

  1. Double-click the field name in Microsoft Query.

  2. In the Edit Column dialog box, type your field name alias surrounded by quotation marks.

    For example, type
    "Fred" (with the quotation marks), and then click
    OK.

    After you have returned the data back to Excel, you can use Microsoft Visual Basics for Applications (VBA) to modify the SQL and remove the quotation marks from a QueryTable or from a PivotTable:

    ActiveSheet.Querytable(1).SQL = "new sql string"
    ActiveSheet.PivotTables(1).Pivotcache.Commandtext = "new sql string"

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section of this article.

More Information

Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:

322756 How to back up and restore the registry in Windows After you install this hotfix, follow these steps to set the AllowAlias registry key and to enable the hotfix. Use the appropriate steps for your version of Excel.

Excel 2010

You do not have to install the hotfix. To enable this hotfix, follow these steps:

  1. Exit all Office programs..

  2. Click Start, and then click Run.

  3. In the Open box, type regedit, and then click OK.

  4. Locate, and then click to select the following registry subkey:  HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\query\optionsAfter you select the subkey that is specified in step 4, point to New on the Edit menu, and then click DWORD Value.

  5. Type AllowAlias, and then press ENTER.

  6. Right-click AllowAlias, and then click Modify.

  7. In the Value data box, type 2, and then click OK.

  8. On the File menu, click Exit to exit Registry Editor.


Excel 2007

You do not have to install the hotfix. To enable this hotfix, follow these steps:

  1. Exit all Office programs..

  2. Click Start, and then click Run.

  3. In the Open box, type regedit, and then click OK.

  4. Locate, and then click to select the following registry subkey:

    HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\query\options

  5. After you select the subkey that is specified in step 4, point to New on the Edit menu, and then click DWORD Value.

  6. Type AllowAlias, and then press ENTER.

  7. Right-click AllowAlias, and then click Modify.

  8. In the Value data box, type 2, and then click OK.

  9. On the File menu, click Exit to exit Registry Editor.

Excel 2003

You do not have to install the hotfix. To enable this hotfix, follow these steps:

  1. Exit all Office programs..

  2. Click Start, and then click Run.

  3. In the Open box, type regedit, and then click OK.

  4. Locate, and then click to select the following registry subkey:

    HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\query\options

  5. After you select the subkey that is specified in step 4, point to New on the Edit menu, and then click DWORD Value.

  6. Type AllowAlias, and then press ENTER.

  7. Right-click AllowAlias, and then click Modify.

  8. In the Value data box, type 2, and then click OK.

  9. On the File menu, click Exit to exit Registry Editor.

Excel 2002

This update was first included in Office XP Service Pack 3. For additional information about the latest service pack for Office XP, click the following article number to view the article in the Microsoft Knowledge Base:

307841 How to obtain the latest Office XP Service Pack To enable this hotfix, follow these steps:

  1. Exit all Office programs..

  2. Click Start, and then click
    Run.

  3. In the Open box, type
    regedit, and then click OK.

  4. Locate, and then click to select the following registry subkey:

    HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\query\options

  5. After you select the subkey that is specified in step 4, point to New on the Edit menu, and then click
    DWORD Value.

  6. Type AllowAlias, and then press ENTER.

  7. Right-click AllowAlias, and then click
    Modify.

  8. In the Value data box, type
    2, and then click OK.

  9. On the File menu, click
    Exit to exit Registry Editor.

Excel 2000

To enable this hotfix, follow these steps:

  1. Exit all Office programs..

  2. Click Start, and then click
    Run.

  3. In the Open box, type
    regedit, and then click OK.

  4. Locate, and then click to select the following registry subkey:

    HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\query\options

  5. After you select the subkey that is specified in step 4, point to New on the Edit menu, and then click
    DWORD Value.

  6. Type AllowAlias, and then press ENTER.

  7. Right-click AllowAlias, and then click
    Modify.

  8. In the Value data box, type
    2, and then click OK.

  9. On the File menu, click
    Exit to exit Registry Editor.

References

If you do not have to use aliasing with Microsoft Query, you can turn off aliasing completely.

For additional information about how to turn off aliasing in Microsoft Query, click the following article number to view the article in the Microsoft Knowledge Base:

259347 XL2000: Error Message: ORA-00923:FROM Keyword Not Found Where Expected

Tarvitsetko lisäohjeita?

Haluatko lisää vaihtoehtoja?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Oliko näistä tiedoista hyötyä?

Mikä vaikutti kokemukseesi?
Kun valitset Lähetä, palautettasi käytetään Microsoftin tuotteiden ja palveluiden parantamiseen. IT-järjestelmänvalvojasi voi kerätä nämä tiedot. Tietosuojatiedot.

Kiitos palautteesta!

×