William:
Thanks for that set of tips it of how you do this via Excel. It gave me sufficient information to work out the best way for me to do this.
I've outlined this below in case anyone else finds it useful. You need an intermediate level of MS-ACCESS knowledge to do this, but it is not too hard.
On the Access Form I use to enter songs, I added a new command button, named it "cbZionWorx" and added the following code using the Code Builder as its [Event Procedure] which is executed when the command button is clicked:
- Code: Select all
--snip
Private Sub cbZionWorx_Click()
DoCmd.TransferDatabase acImport, "dBase III", "C:\Program Files\ZionWorx", acTable, "songs.dbf", "ZionWorxSongs", True
DoCmd.OpenQuery "qZionWorx"
DoCmd.TransferDatabase acExport, "dBase III", "C:\Program Files\ZionWorx", acTable, "ZionWorxSongs", "addsongs.dbf"
DoCmd.DeleteObject acTable, "ZionWorxSongs"
End Sub
--endsnip
The code creates a temporary table called ZionWorxSongs which has the structure of the Zionworx song.dbf file. It runs the MS-Access append query "qZionWorx" to populate the ZionWorxSongs table. It exports the ZionWorxSongs table to a new (or replaced) dBaseIII file called addsongs.dbf. Finally it deletes the temporary table ZionWorxSongs.
Then I created the MS-Access append query. My Access database has a master table - called SNGLISTS. It has the following fields in it which are relevant to this export process: TITLE, WORDS, AUTHOR, MAIN_KEY, COPYRIGHT
I created the Append query (qZionWorx) in my Access database. In my case it was a little complex, but this shows what can be done. In some cases where I had no words I defaulted the text to "not yet entered", as ZionWorx seemed to not like it when there were no words on import. The SQL code behind the append query was as follows:
- Code: Select all
INSERT INTO ZionWorxSongs ( TITLE_1, TITLE_2, LYRICS, WRITER, COPYRIGHT, [KEY], CATEGORY )
SELECT SNGLISTS.TITLE AS TITLE_1, "" AS TITLE_2, IIf(Len([snglists].[WORDS])>0,[snglists].[words],"not yet entered") AS LYRICS, IIf(Len([AUTHOR])>0,[AUTHOR],"TBC") & IIf(Len([MAIN_Key])>0," Key: " & [MAIN_Key],"") AS WRITER, IIf(Len([SNGLISTS].[COPYRIGHT])>0,[SNGLISTS].[COPYRIGHT],"tbc") AS COPYRIGHT, "" AS [KEY], "" AS CATEGORY
FROM SNGLISTS;
With these two steps done in MS-ACCESS, I can now click on the command button in my Access form. The temporary table structure is created from ZionWorx, it is populated by my append query, written out and then deleted.
I then launch ZionWorx, unlock the database, select the import option, select the addsongs.dbf file (stored in c:\Program Files\ZionWorx) and import what I need (or everything).
I also tried this overwriting the ZionWorx songs.dbf file by changing "addsongs.dbf" to "songs.dbf". It does work, this negates the need for the import withing ZionWorx.
The bottom line for us is that our own DB is the master database, and ZionWorx is the output handler.
NB: This was done with Access 2000. If it fails, it may be you need the dBase III drivers installed.