DATABASE Field Failing

Kathy Bradley

New Member
Joined
Aug 11, 2021
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
Hi,

I would really apprecaite any help! My scenario is:
  • I have an Excel list of log entries covering a number of individuals. Each individual has mulitple entries (i.e. multiple rows of data in Excel per individual). We are required to generate a log report for each individual (i.e. a file per individual listing all of their log entries). Historically these have been manually created by filtering the XLSX, copying and pasting into another file - over and over again. This is time consuming and risky so I want to automate it using Word Mail Merge.

  • the log entries are in the file Log Book Data.xlsx on a tab called Log List

  • in the same XLSX I also have another tab called MSWord List which I am using as the data source for the initial MSWord mail merge

  • the Mail Merge DOCX and the XLSX are in the same folder

  • Word doc is set up as a mailings > Start Mail Merge > Letters and has a static title line, then Code: <<Student Code>> (referenced from Log Book Data.xlsx > MS Word List). This part of the Merge works.

  • Below the titel is the database code: {DATABASE \d "{FILENAME \p}/../Log Book Data.xlsx" \s "SELECT [Provider Name], Date of Attendance], [Attendance Duration], [Comment] FROM [Log List$] WHERE {MERGEFIELD Student_Code} ORDER BY [Provider Name] " \l "15" \b "49" \h}

    I can confirm that both FILENAME and MERGFIELD are updating appropriately

  • The first time I ran it, the code worked beautifully, but now when I run it, I get an error stating An operation cannot be completed because of database engine errors. The next pop-up is the Data Link Properties window which is showing the path to my Log Book Data.xlsx without the \s which I thought might mean the computer can't find the files. I manually re-entered them but it doesn't help. (N.B. it is NOT losing the \s on the Word file path).

Image

The next error in the sequence says Word was unable to open the data source.

I have tried creating new Word docs from scratch, new XLSX, moving the folder containing both files (from OneDrive to my local drives), turned the computer off, took out the spaces in the names, added _ instead of spaces in the DATABASE code, had the XLSX open and closed while running the Merge, I am also using CTRL+F9 to add the curly braces ;)... all the standard things, but no impact. Any help would be very much appreciated.
 
Last edited by a moderator:

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,214,989
Messages
6,122,622
Members
449,093
Latest member
catterz66

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top