Combining 84 tables with one query...help!

R

refreshingapathy

Hello,

I'm making a database for my college's radio station. They want each
DJ to have his/her own little table to keep track of which songs are
played on each show.


The problem is that I need to combine all these tables to be able to
sort them.

In each table, I have an autonumber assigned for the song number
(purely because access put it there), fields for the artist's name,
song name, album name, track number; then a yes/no box for whether the
song is in "rotation" or not (our DJs must play 4 of these "rotation"
songs per hour of their show). Is combining necessary? All I need to
do is compile a list of how many times each "rotation" song was played
accross all the tables...I'm more than willing to do any tweaks to the
table layouts to get this to work.

Thanks!
Rick Heil
 
J

John Vinson

Hello,

I'm making a database for my college's radio station. They want each
DJ to have his/her own little table to keep track of which songs are
played on each show.

That's a VERY bad idea. Use *ONE* table, with a DJ field; each DJ can
use a query to see their portion of the data.
The problem is that I need to combine all these tables to be able to
sort them.

That's *why* this is a bad idea.
In each table, I have an autonumber assigned for the song number
(purely because access put it there),

Access only puts it there if you ask it to. It does suggest it but
does not require it.
fields for the artist's name,
song name, album name, track number; then a yes/no box for whether the
song is in "rotation" or not (our DJs must play 4 of these "rotation"
songs per hour of their show). Is combining necessary? All I need to
do is compile a list of how many times each "rotation" song was played
accross all the tables...I'm more than willing to do any tweaks to the
table layouts to get this to work.

How about a major rewrite instead...? :-{(

I'd see at LEAST the following tables:

Songs
SongID <Primary Key>
Title
AlbumID

Artists
ArtistID
ArtistName <might be a person's name or a group>

SongArtists
SongID <link to Songs>
ArtistID <link to Artists>

Albums
AlbumID
Title
<other info about the album>

DJs
DJID
LastName
FirstName

Playlist
DJID <who's playing the piece>
SongID
WhenPlayed

This is going to be a rather complex application!

John W. Vinson[MVP]
 
D

David F Cox

Are the DJ's working from their own machines, i.e. laptops?

You should have a master database and append each DJ's work. The
synchronising functions of Access are built for this sort of task, or you
could import new data as CSV files.
 
R

refreshingapathy

John and David,

I do appreciate your help and the enormous complexity of this task...

To answer David's question, no, they will all be working from the same
machine. The college is iffy about me setting up a server for some
reason, so it will all have to be on one machine.

I'm relatively new to Access (I'm willing to bet it shows), this was
really the only way I could work out to keep everything seperate. The
station is adamant they be able to tell exactly who is playing what....



John's table suggestions - would the "artist" and "song" tables here
require I have an index of all the artists and songs to begin with? We
have over 10,000 CDs and 2,500 LPs (vinyl!), so writing down all the
artists and songs would be a nearly impossible task. There is software
to do such a thing, but I don't think I could convince the station
managers to spend any time whatsoever on it, they're pretty set in
their ways about computers (the less, the better for them - before now
they only used them to record promotions, and even that only since 2
years ago - they were still using 8-track cartridges).

Again, thank you very much for the advice!
 
D

David F Cox

I suspect that John has been down the "Give them this and they will want
that road." quite often. The DJ's I know would be asking "where the bpm?".

84 tables - NO WAY

I would have the tables designed along the lines that have been suggested.

I would have the DJ having to sign in to use the application. I would take
care to ensure that each DJ had a very different looking form, and one big
button to sign out. A colour scheme for each is one way, but a picture of
their choice as a background is much more DJ style. This would ensure that
there was no excuse for being logged in as another user.
 
R

refreshingapathy

84 tables is excessive - that comes to one table per show.

The only reason I haven't done a "sign in" is simply because I don't
know how. Could you point me to a tutorial or something to show me how
to do this?

Thanks a bunch for your help!

Rick Heil
 
R

refreshingapathy

Of course there's always the help menu (duh). I'll be back with more
questions on how to implement I'm sure, but for now I'm creating my
users.


Thanks a ton!

Rick Heil
 
R

refreshingapathy

I have the users now set up, and the tables as John suggested.

Another newbie question - I know how to make the switchboard pop up at
startup, but how do I prompt the users to log in?

Don't know if it makes a difference, but I'm using Access 2000 SR-1,
running Windows 2k Professional.


Thanks again,
Rick Heil
 
K

Ken Sheridan

Rick:

The 'sign in' is quite simple to set up. As the application's opening form,
frmLogIn say, you just need an unbound dialogue form with a combo box, cboDJ
say, with the following as its RowSource:

SELECT DJID,
Firstname & " " & LastName AS FullName
FROM DJs
ORDER BY LastName, FirstName;

Set the combo box's BoundColumn property to 1, its ColumnCount to 2 and its
ColumnWidths to 0cm;8cm (or rough equivalent in inches, but the first
dimension must be zero).

Add a 'Confirm' button to the form with the following in its Click event
procedure:

If Not IsNull(Me.cboDJ) Then
DoCmd.OpenForm "frmPlayList"
Me.Visible = False
End If

where frmPlayList is a form bound to the PlayList table. I'd see this table
differently, however, so that its not just the song played that's recorded
(no pun intended!) but the version of the song , i.e. the song artist and
album (how my instances of Bob Dylan's 'Like a Rolling Stone' are there on
separate albums for instance?). This would mean changing the SongArtists
table to:

SongVersions
SongVersionID <autonumber primary key>
SongID <link to Songs>
ArtistID <link to Artists>
AlbumID <link to Albums>

And the SongID field in the PlayList table would now be SongVersionID.

In the Open event procedure of the play lis form set the DJID default value
to that selected in the log in form with:

Me.cboDJ.DefaultValue = """" & Forms("frmLogIn").cboDJ & """"

This would mean you'd have a cboDJ combo box on the play list form, but this
time bound to the DJID field in the PlayList table. The quotes in the above
line of code BTW are because the DefaultValue property is a string expression
regardless of the data type of the underlying field. Often they are not
essential, but its always best to include them as sometimes they can be
crucial when you might not think they'd be needed. This combo box should be
prominent on the form as it would be used if the DJ changes without having to
close down the application. Its AfterUpdate event procedure should set the
hidden log in form's combo box to the DJ select so the two are kept in sync
with:

Me.cboDJ = Forms("frmLogIn").cboDJ

On the play list form would be a list box bound to the SongVersionID field
with a multi-column list which lists the songs alphabetically along with the
artist and album in other columns of the list.

In answer to your point about the number of songs/albums etc. you don't need
to add all of the collection to the database at the start. It can be done on
the fly as each song version is first played, so the tables would build over
time. You'd just need a 'New Song Version' button on the form which would
open another form to add a new song version row to the SongVersions table and
then returns to the play list form with the new song version selected. As it
happens I've recently been working on a nursing qualifications database for a
hospital which, while the type of data is very different, does something very
similar to this in principle, so I know it can be done relatively easily.

You can combine the two approaches of course; for instance you might want to
set up a procedure where new CDs are added to the tables when acquired.

I you wish to automate the entry of the WhenPlayed date/time into the table
you could have the following code in the list box's AfterUpdate event
procedure so that current the date/time is automatically entered when a song
version is selected:

Me.WhenPlayed = Now()

Note that when a new song version is added in another form you'd have to set
the value of the WhenPlayed control in the play list form as well as
requerying and setting the value of the list box to the new song version.
This is because the AfterUpdate event only fires as a result of user action,
not the assignment of a value to a control in code.

Ken Sheridan
Stafford, England
 
J

John Vinson

I have the users now set up, and the tables as John suggested.

Another newbie question - I know how to make the switchboard pop up at
startup, but how do I prompt the users to log in?

Don't know if it makes a difference, but I'm using Access 2000 SR-1,
running Windows 2k Professional.

Get the Microsoft Access 2000 Security Whitepaper from

http://support.microsoft.com/kb/207793/en-us

It still applies to later versions. STUDY IT CAREFULLY - security is
complicated and can easily be done wrong!

I'd suggest having each DJ have their own logon, and having the Form
set up to use the CurrentUser() to automatically filter the table to
just their own data.

John W. Vinson[MVP]
 
R

refreshingapathy

Ken,

Just what the Microsoft doctor ordered!

I got the combo box working no problem (I did, however, choose to show
both first and last names, there are quite a few duplicates of first
and last names...for instance, we have two - yes, two - members named
John Rosenberg. Interesting, eh?).

Anyways, when I went to configure the "on click" script, i get the
following error:

"Microsoft Access can't find the macro 'If Not IsNull(Me.'
The macro (or its macro group) doesn't exist, or the macro is new but
hasn't been saved. Note that when you enter the
macrogroupname.macroname syntax in an argument, you must specify the
name the macro's group was last saved under."


I don't understand this error....should I be making the code you posted
into a macro and then having the "on click" just execute that macro?

Thanks,
Rick Heil
 
R

refreshingapathy

John,

About the tblSongArtist - would there be another column to function as
a song id number? My mind hasn't worked itself around your design. I
see how most of it fits together, but you lost me on the SongID and
ArtistID - which goes back to my question.

Thanks,

Rick Heil
 
J

John Vinson

I don't understand this error....should I be making the code you posted
into a macro and then having the "on click" just execute that macro?

No. What I posted was VBA code - an Event Procedure. In the click
event, select the ... icon and choose Code Builder, and paste the code
(edited appropriately) into the VBA editor. Access will give you the
Sub and End Sub lines for free (don't duplicate them).

The Click property should show [Event Procedure] in form design view.

John W. Vinson[MVP]
 
J

John Vinson

John,

About the tblSongArtist - would there be another column to function as
a song id number? My mind hasn't worked itself around your design. I
see how most of it fits together, but you lost me on the SongID and
ArtistID - which goes back to my question.

Thanks,

Rick Heil

Sorry... that was pretty compressed!

I'm presuming that any individual Song might have more than one Artist
(a trio, maybe), and any Artist will have multiple Songs.
TblSongArtist contains the values of all artists who perform on a
particular song (and vice versa); if a given song is performed by a
trio of artists there would be three records entered into the table
for that song. You'ld use a Form with a Subform, probably with a combo
box selecting the artist.

John W. Vinson[MVP]
 
R

refreshingapathy

This newgroup is excellent, I have things up and running nicely, save
one thing - how do I get the login to carry over?

I'm not sure how to get the DJID value to carry over from the login
form to the playlist - what method should I be using to pass that
value? (access newbie-ism is showing now).

Also, is there a way to put a "log out" button on the playlist form?
That way the user wouldn't have to close and re-open the database.


Thanks,
Rick Heil
 
J

John Vinson

This newgroup is excellent, I have things up and running nicely, save
one thing - how do I get the login to carry over?

I'm not sure how to get the DJID value to carry over from the login
form to the playlist - what method should I be using to pass that
value? (access newbie-ism is showing now).

I *think* - haven't actually had occasion to do this so I'm not sure!
- that you can set the DefaultValue property of a form textbox (on the
Playlist form) to

=CurrentUser()


John W. Vinson[MVP]
 
R

refreshingapathy

I *think* - haven't actually had occasion to do this so I'm not sure!
- that you can set the DefaultValue property of a form textbox (on the
Playlist form) to

=CurrentUser()


John W. Vinson[MVP]


Nope....gives me the error "Unknown function 'Current User' in
validation expression or default value on 'tblplaylist.DJID.'"


Keep in mind I'm using the above scripts to do the login....anything
else you can think of?
 
D

Douglas J. Steele

refreshingapathy said:
Nope....gives me the error "Unknown function 'Current User' in
validation expression or default value on 'tblplaylist.DJID.'"

Sounds as though you tried to set the DefaultValue for the field in the
table.

John was saying to set it for the text box on the form.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top