taimatsu: (minako)
[personal profile] taimatsu
I am putting together a MS Access database to function as a high-tech searcheable songbook. It's all laid out and working well. I have assorted fields and checkboxes at the top, and then the song title and so on, and then a field, obviously, for the song lyrics. I can't put these in as text or memo fields because the length for those is too restrictive. I have, therefore, a lot of plain text documents with the lyrics in, in a separate folder, and I want to apply these to the database. I thought I had it taped, because dragging-and-dropping adds them in as OLE bound objects (stored in the database file). That's fine. I'd also be happy to do them as linked docs, hyperlinks, whatever.

However, it has just fallen apart. I have *two* versions of 'The Dawning of the Day', and I want to record both using separate text files. I just cannot work out how to do this. An OLE Object field will only take one object. AFAICT, a hyperlink field will only take one hyperlink. Text fields won't do any of this stuff. I'm stuck! Anyone got any ideas?

Date: Sunday, 26 March 2006 06:41 pm (UTC)
From: [identity profile] crocodilewings.livejournal.com
Do you know what a junction table is?

Date: Sunday, 26 March 2006 07:13 pm (UTC)
From: [identity profile] crocodilewings.livejournal.com
Heresy.

OK. Illustrative diagram.

Image

Table A contains the basic song information, as well as a primary key (in this case a non-meaningful, surrogate autonumber called ID. This is not the only way to handle primary keys, and many brutal wars have been fought over the issue, but for demonstration purposes we'll stick with this one).

Table C contains a series of lyrics stored as OLE objects, and a primary key, also an autonumber named ID.

Table B is the junction table. It defines which lyrics go with which song, by saying which SongsID goes with which LyricsID.

Actually, you don't even need a junction table, since if it's a songbook, it's unlikely that you're going to have one set of lyrics that go with many songs. You could do it like this:

Image

So you have one table for songs, and one table for lyrics, and in the Lyrics table you have a field to designate a song to the record.

I think I'm just junction-happy. :-)

Date: Monday, 27 March 2006 11:25 pm (UTC)
From: [identity profile] crocodilewings.livejournal.com
You'll want the Lyrics table to have its own primary key, and a field for the primary key of the song each relationship relates to (called a foreign key when it's not in its own table).

Once that's done, have a look at using the Lookup Wizard on the foreign key.

Date: Friday, 7 April 2006 02:43 pm (UTC)
From: [identity profile] crocodilewings.livejournal.com
Or I could show you at some point.

added another couple of OLE fields

Date: Monday, 27 March 2006 09:18 am (UTC)
From: [identity profile] undyingking.livejournal.com
This is extremely evil behaviour ;-)

[livejournal.com profile] crocodilewings's advice is good, you should get normalizing!

Date: Monday, 27 March 2006 12:10 am (UTC)
chrisvenus: (Default)
From: [personal profile] chrisvenus
I'd just have two rows, one for "The Dawning of the Day (normal)" and one for "The Dawning of the Day (Smut filk)" or something like that. Treat them as different songs and I'm sure it'll be fine. :)

Date: Monday, 27 March 2006 09:31 am (UTC)
From: [identity profile] danfossydan.livejournal.com
Either do that! Or merge the two text files together - so that the first version follows on from the seccond version in the same text file.

Then you just have one entry.

Date: Tuesday, 28 March 2006 08:40 am (UTC)
From: [identity profile] danfossydan.livejournal.com
Then having "The Song I love" And "The Song I love (alternate version 1)" Is I think the easiest solution.

Completely unrelated to post

Date: Monday, 3 April 2006 11:52 am (UTC)
From: [identity profile] angel-feather.livejournal.com
But this is mistress_carrot's writing journal and because I'm using it again I've updated my friends list to include you :)

Date: Thursday, 13 April 2006 09:17 pm (UTC)
From: [identity profile] theghostcat.livejournal.com
Hi! I saw in you interest "rosacea". Do you have any personal experience with using seabuckthorn products? Positive or negative.

Profile

taimatsu: (Default)
taimatsu

April 2019

M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags