Newb Question on linking tables

Trachr

Registered User.
Local time
Today, 04:10
Joined
Jun 1, 2014
Messages
90
So Im in the process of working on my database, I have my tables pretty much worked out, what they will do, even some of my forms done now..

However there are a few tables Im having issues with...

I have 1 table, call it tblcomics which has the primary key as ComicID, then its next 3 fields are Series, Volume, and Issue

Then I have another table called tblstoragelocation Its fields are as follows: (primarykey which is hidden), ComicID, Series, Volume, Issue, and then Storage Box

I have the tables linked via One to Many from Comic ID to Comic ID.. that was easy enough however here comes my issues

I cant link series, volume, and issue... since im dealing with the same comic I would like to find a way to make sure those stay the same throughout the 2 tables... is this possible? Im sorry if this is easy, Im still newish

Also is it possible to propegate this so I enter it in tblcomics and the data will be in tblstorageloc?


Ill start with this problem then will ask my next question once I figure this one out lol

Thank you!


oh some details... sorry

The current link between tables has enforce referential integrity on as well as cascade update related fields and delete related fields

AS for my types of fields, the comic ID is a number, and the rest are short text
 
even if thats impossible I suppose I could just delete the series volume and issue from the storage box table... technically I all I need there is the ID number and the box... since I could reference the ID number via tblcomics and know which comic it is.

I do still have a problem even if I use this method, of saving the data... say I make a form to save all the info about a comic, I would want to enter what location it is in on that same form.

From what I can tell you can only save on a form data to 1 table... and Im looking at multiple tables that I would need to save to.

is my design unfeasable completly, perhaps I need a flatter db
 
It sounds like you need to do some research on Normalization. You have Series, Volume, and Issue all saved in multiple tables, for starters. You can read up on that here: http://databases.about.com/od/specificproducts/a/normalization.htm . If you Google the term, you'll find a LOT of guides for it.

That said, it looks like you will need tables for Comics, Series, Storage Locations, and Condition (if you track that - another poster here is making a comics db right now and is definitely tracking it). I don't know at which level volume applies, but it will be either Comics or Series, depending of if comics in the same series can have different volume numbers or not. Issue number definitely belongs on the Comics table alone.

Anyway, once you have a grasp on normalization, laying this puppy out will get a lot easier.
 
Ok I read through that and I think on some level I was already trying to figure out a way to do it like that... after I posted here I did decide that having series name, issue, and volume in addition to comic id was pointless since Ive established what comic = what comic ID in another table... seemed a lot of extra unneeded data

and I do have a table for series specifically, in fact I think the otehr person doing this was me... if it was the person who wrote a friggin book asking about general table setup that was me lol... but as this is a seperate issue I figured I should make a seperate post but if I should keep it all in 1 post Ill start posting all my specific questions there if you think that would be smarter...

But anyway... in terms of normalization, Im going to reference 2 tables I have and see how you think it should be done

My series table consists of: Series, publisher, current volume, and a check box if Im activlely collecting that series currently

My tblcomics consistss of: Comic ID, Series, Volume, Issue ... and some more stuff

now the volume may seem unneeded since its in 2 tables but the one in my tblseries is there simply to make my life easier when entering a new comic into tblcomics Its to let me know what the current volume is now... not that I HAVE to have that volume since I may also have older volumes of that same series

My question is in regards to the series field itself... does that follow normalization rules I mean I need to have a way to designate which series each issue belongs to, Im just unsure if my way is the correct way. The other option Ive came up with would be to have a table for each series and to track what issues were in that series in said table.

But that seems like way too many tables to me... which is why I chose this solution.


My next question as far as I could see all the normalization in the world wont solve... I have many tables that reference the same comicID well 3 tables that do anyway. so How do I set up a form that allows me to edit all 3 tables.... My understanding is that a form can only edit 1 table at a time.

Thanks
 
You definitely don't want a table for each series. Your setup looks more or less right:

tblSeries
SeriesID_PK (autonumber)
SeriesName (text)
PublisherID_FK (long integer)
CurrentVolume (integer)
Collecting (yes/no)

tblPublishers
PublisherID_PK (autonumber)
PublisherName (text)

tblComics
ComicID_PK (autonumber)
SeriesID_FK (long integer)
Volume (integer)
IssueNumber (integer)
ConditionID_FK (long integer)

tblConditions
ConditionID_PK (autonumber)
ConditionName (text)
ConditionDescription (memo)

You could even put either a 'current value' field in tblComics, or a 'value history' in its own pricing history table.

***

As to editing - this is where you use main and subforms. The main form would be based on a query which itself is based on tblComics, while the subform(s) would be based on the tables that are on the 'many' side of the relationships.

If you want to put multiple subforms on one form, my suggestion is to put them into a tab control, so you can switch between them as needed. (It's also possible, with code, to have an option group, combo box, or list box control which subform is displayed in the subform control.)
 
ya I think Ill use tabs... for some reason I wasnt thinking about alternatives instead I was thinking in terms of 1 form again... wish I could blame that on me knowing excel first like most my problems with this system lol... but I think this was just a case of me being dumb and not thinking things through :)

Thanks!

My next question... just your personal feelings on the best way to achieve this.... when I enter into the main form for comics there will be a volume field... hows the best way to somewhere around that field or in it even to show what number I have as CurrentVolume (integer) in tblseries Ive always had that in tblseries so I could have a reference point when entering current comics.

Its really annoying sometimes finding what volume you have so if I buy a new comic I want to save myself that trouble and just know what volume it is....thus the current volume field

thats the one other area I forsee me needing help so figrued Id ask before I got there
 
Last edited:
oh to answer my own question possibly... is the use of a subreport inside the primary form a possibility?
 
Just thought of something - you had mentioned wanting to track the current value of each comic. If that's the case, and you're not interested in a value history, add 'Value' and 'ValuationDate' to tblComics as currency and date (short date) fields, respectively. That will also allow you to see what comics you've not updated recently, and you can add code that automatically fills in the date when you update the value.
 
so another dumb question since I just found the 10 commandments lol and wish I woulda read those earliar... :p

Thou shalt split thy databases. what does that mean? does that mean just dont do a flat 1 table database?

and what are sendkeys and smart codes etc... that im not suppose to be using lol
 
You would use a subform, not a subreport, but it's definitely a possibility. They're actually quite handy once you know how to use them.

***

A split database means you have one file (the front end) with the forms, queries, macros, reports, and modules included, and a different file (the back end) with the tables in it. The front end is placed on every user's workstation, while the back end is kept on a network location.

The is done because Access gets REALLY wonky when multiple people access the same forms at the same time, and it really doesn't like executing more than one batch of code at a time. (Meaning that if two people try to run something that uses code, it will run one person's procedure, and THEN the other person's.) It also allows for easier updating of the front end, without having to worry about keeping the data up to date while you make changes.

If you're not in a network situation, then there's no need to split your database, although the ability to update the database without having to synch up the data may still apply.

***

SendKeys basically lets you send keystrokes to whatever the active window is. You can read about it HERE.

I have to admit, I'm not entirely certain what SmartCodes are - I've never encountered them (so far).
 
interesting, thank you

As to your comments about value earliar... thinking long term it would be nice to be able to track value from year to year so I could graph increases or decreases in value over the years...

"ideally" I could have a form set up when I pull up a record for a specific comic that shows the usual details, as well as the current value then if I click a button or something it would pull up another window that could show past values with a graph.

The problem there as I spoke about in my other thread I think is Im unsure how to go about adding years and for it to fit well in my form... Id rather not to have to change things once the DB is made but I dont know a way to accomplish with what I want without adding a new field everytime I add a value for the year... so like now I could make the 2014 value but next year Id need a 2015 column.... I suppose I could just make a ton of fields now and leave em blank, like fields for the next 5 or 6 years.

That could be an option but then comes the form aspect... could I make a function or something that would fill out the current value as the latest date that has a value? From what I know of... the only way to accomplish this would be to alter the forms coding every year.

What do you think? If this is all impossible Ill do as stated earliar and just do a current value and not maintain historic values... Im just thinking it would be a cool feature if manageable.


its amazing how much planning and forethought goes into a good database lol
 
Nope, instead of adding a new field, you'd have:

tblComicValues
ComicValueID_PK (autonumber)
Value (currency)
ValuationDate (date -> Short Date)

Then in the comic form, you would show the most recent value for the selected comment in a locked field. If you want to update the value, you would insert an 'update' button next to the field. That might pop up an input box asking the new value, and once you've entered it, it would add that value, the current comic's ID, and the current date to tblComicValues.

Yeah, databases can take on a life of their own once you sit down and figure out what you want to do. Just keep in mind that it's virtually always easier to add in what you need up front than to do it after the fact. That's why it's so vitally important to figure out everything you want the system to do right up front.

This would also allow you to include a graph on the form showing value history.

Edit: Also, look into Tab Controls. They allow you to add more data to a form while at the same time break it down into easily digestible chunks of data.
 
Im still trying to get my head around this...

So in the value table, each comic could potentially have multiple rows in that table then right? Sorry for some reason Im really slow when it comes to understanding whats going on there ... sometimes I catch on quick sometimes slowly I guess... Also in tblecomicvalues as you wrote up there, wouldnt there be 1 more field for comicid?
 
so having thought about what you said on things being easier to do now as opposed to after I have a working database... Ive decided I should add the ability to do a few more things, things I thought after I learned more I may add... or had thought of in passing thinking it would be cool... well easier to do now then later

Anyway to tblcomics I figured I would add a cover field, and a varient field since sometimes comics are varients or have different covers.. the varient I figured would be a yes no, and coverr would be short text

I also decided to add an attachment option to this so that I could have the option of snapping a pic of a cover to remind myself of what something is without having to fish it out of the storage boxes.

Please let me know if these throw up any alarm bells that I am unaware of.

My next alteration is in my storage keeping in general... in fact I think Im going to revamp it somewhat... now in all honesty I doubt this will be needed but I figure Ill plan for the worst case scenario where for some reason my comic collection grows alot and I need a lot more storage space.

Anyway having worked in an office building before I know that sometimes its nice to be able to find a record, or in this case a comic, without having to consult my databse... so Im altering my box numbering system so that the box name itself would let me have a general idea about what was in that box.

Basically I want the name to consist of a few things for convenience and yes Im probably going way overboard but part of the reason Im doing this is also to learn access lol so I may as well try it

ANyway my label would consist of something like this: (T)(Z)(P)(A)(#) P being the difficult part which Ill get into in a sec

T = box type so a short box may be the letter S or a long box L or a tote T
Z = Storage Type... if the box was series specific, S, Publisher P, or Mixed M
P = Publisher(s) so (D)C (M)arvel (I)mage
A = Active... is this a box that I have an active series in or one im done collecting
# = number of box simple enough

Some of that I really dont need but I can see a situation where I could potentially want it so I figured I may as well do it, I can always remove things later.

This is going to stretch my knowledge in access even more since its going to mean I want a table called say tblstorageboxs which simply lists the various boxes available
then I would have my tblstorageloc which would have the actual comic locations... so to draw it out Im thinking along these lines:

tblstorageboxes
-BoxID (main key)
-type
-active
-number
-(MAYBE)box full yes/no

tblstorageloc
-ID(needed field but not for my purposes so hidden)
-BoxID (linked to Box ID above)
-ComicID (linked to my tblcomics)

I also was considering adding

tblstorageboxtype
-type (mainly so I can easily select it later from a dropdown menu for tblstorageboxes)
-(MAYBE)capacity that way I can monitor when a box is getting full

as for the capacity and above box full yes no thing... I would say the box capacity would be there so I could when going to add a comic to a box I could have a dialoge where it shows me how many comics are in a box, as well as the box capacity... then I could also have a check box there so I could mark a box as full and close it off persay


anyway thats where my thoughts are atm, Ill be honest its late and I had a rough day so its entirely possible Im slightly insane in this lol but I still wanted to bounce it off you so you could either tell me im going way over board or if not help me refine my ideas some.


Thanks again

lol when this is all said and done Ill have to offer my database up on the net for all other comic collectors out there since the closest thing to this is like 50 dollars... the more expensive ones can also automatically check values in some database somewhere but ya... no way will I attempt that one lol
 
Im still trying to get my head around this...

So in the value table, each comic could potentially have multiple rows in that table then right? Sorry for some reason Im really slow when it comes to understanding whats going on there ... sometimes I catch on quick sometimes slowly I guess...

Yes, each comic could end up with multiple rows in tblComicValues. That's why in the display form, you'd normally only show the CURRENT value, although it wouldn't be hard to add a value history subform on the tab control.

Also in tblecomicvalues as you wrote up there, wouldnt there be 1 more field for comicid?

Good catch! That'll learn me to reply while eating!
 
Last edited:
so having thought about what you said on things being easier to do now as opposed to after I have a working database... Ive decided I should add the ability to do a few more things, things I thought after I learned more I may add... or had thought of in passing thinking it would be cool... well easier to do now then later

Anyway to tblcomics I figured I would add a cover field, and a varient field since sometimes comics are varients or have different covers.. the varient I figured would be a yes no, and coverr would be short text

Both of these sound fine.

I also decided to add an attachment option to this so that I could have the option of snapping a pic of a cover to remind myself of what something is without having to fish it out of the storage boxes.

Also perfectly fine. My only suggestion might be that if there's a likelihood of multiple attachments, you may want to turn THIS into a linked table as well rather than simply a field in tblComics.

Please let me know if these throw up any alarm bells that I am unaware of.

None so far.

My next alteration is in my storage keeping in general... in fact I think Im going to revamp it somewhat... now in all honesty I doubt this will be needed but I figure Ill plan for the worst case scenario where for some reason my comic collection grows alot and I need a lot more storage space.

Anyway having worked in an office building before I know that sometimes its nice to be able to find a record, or in this case a comic, without having to consult my databse... so Im altering my box numbering system so that the box name itself would let me have a general idea about what was in that box.

Basically I want the name to consist of a few things for convenience and yes Im probably going way overboard but part of the reason Im doing this is also to learn access lol so I may as well try it

ANyway my label would consist of something like this: (T)(Z)(P)(A)(#) P being the difficult part which Ill get into in a sec

T = box type so a short box may be the letter S or a long box L or a tote T
Z = Storage Type... if the box was series specific, S, Publisher P, or Mixed M
P = Publisher(s) so (D)C (M)arvel (I)mage
A = Active... is this a box that I have an active series in or one im done collecting
# = number of box simple enough

Some of that I really dont need but I can see a situation where I could potentially want it so I figured I may as well do it, I can always remove things later.

This is going to stretch my knowledge in access even more since its going to mean I want a table called say tblstorageboxs which simply lists the various boxes available
then I would have my tblstorageloc which would have the actual comic locations... so to draw it out Im thinking along these lines:

tblstorageboxes
-BoxID (main key)
-type
-active
-number
-(MAYBE)box full yes/no

tblstorageloc
-ID(needed field but not for my purposes so hidden)
-BoxID (linked to Box ID above)
-ComicID (linked to my tblcomics)

You wouldn't put ComicID in this table. Instead, you would include BoxID and StorageLocID in tblComics.

I also was considering adding

tblstorageboxtype
-type (mainly so I can easily select it later from a dropdown menu for tblstorageboxes)
-(MAYBE)capacity that way I can monitor when a box is getting full

as for the capacity and above box full yes no thing... I would say the box capacity would be there so I could when going to add a comic to a box I could have a dialoge where it shows me how many comics are in a box, as well as the box capacity... then I could also have a check box there so I could mark a box as full and close it off persay

Your box full thing here is technically a calculated field, and thus should not be saved in the database. Instead, you can design queries that count the number of comics in each box, and compare them to the max capacity of the box. You can use code or even properties on the controls in order to notify the user if a box is full, or even prevent it from being selected altogether.

Edit: One thing just came to mind. If you're planning on marking a box as being full arbitrarily rather than by the number of comics in it, then yes, you'll need to include BoxIsFull as a field in your Boxes table.

anyway thats where my thoughts are atm, Ill be honest its late and I had a rough day so its entirely possible Im slightly insane in this lol but I still wanted to bounce it off you so you could either tell me im going way over board or if not help me refine my ideas some.


Thanks again

lol when this is all said and done Ill have to offer my database up on the net for all other comic collectors out there since the closest thing to this is like 50 dollars... the more expensive ones can also automatically check values in some database somewhere but ya... no way will I attempt that one lol

Yeah, comic collectors can be nuts. You make this thing good enough, and I'm certain you could sell it to users. Just an FYI, though - if you go that route, you definitely want to lock the code away from prying eyes, which is a lot of work, and Access just is not all that secure. In addition, you would want to convert the final project to an accde or mde file, and even then they need a full Access install to use it. (Another option is an accdr file based on the accde, which only requires the installation of the Access runtime from M$.) Even then, the database can be recompiled. We won't even get into piracy protection.

If you really want to go that route, there are a ton of threads on this site from people asking how to do all that, and you will be VERY familiar with VBA by the time you're done.
 
to the:
Edit: One thing just came to mind. If you're planning on marking a box as being full arbitrarily rather than by the number of comics in it, then yes, you'll need to include BoxIsFull as a field in your Boxes table.

Yes... I would need that ability since sometimes I would put in double size comics or maybe even trade paperbacks etc... so while the automatic counting system would work 90% of the time, sometimes I would need to override it and say it was full myself.

IN the Box info thing for the label...and this is just an idea at this point, would it be possible for access to name and have the option of printing a label for the box?

Seems like in the box naming selection you could have a menu of some sort where it picks the type of box...

Im not sure if you could make it automatically say if it is a series specifc box, publisher specific, or mixed.... that may be better as a user selection though since that probably is something you would want to decide yourself, however, could access warn you if you do something wrong there and go against the intent of the box, for example a batman in a superman box

for P... and this would be mainly for mixed boxes could it automatically put say a shortform into this slot, for instance (D) for DC and M for marvel etc... in fact I could even go so far as in my tblpublishers to add a field for shortform if that would help

A again would be like the box type one above, may be better as a decision made from the user, however if its possible access could cross reference my tblseries since there is an actively collecting box (yes/no) box there

# it would simply be access checking for the last # in the list and adding 1 to it.

In fact the label probably would have a larger #, then below that maybe have all of the options so you could check via just the box identification, and have a pretty good idea on the box, but at the same time you could go just by # as well if you had the db open.

As for selling, I may just do it as a donations only sort of thing if I make it really good... dunno if anyone really donates though and hey as I said Im doing this to learn access so heck I could try to close the code lol... plus learning more VBA can only help me with everything in msoffice, least excel as well... since thats a huge weakpoint in my excelling I do everything possible to avoid vba since I suck at it lol.


In fact back to the boxes thing now that I think about it.... if I have access filtering all that stuff for me, I should just make a listbox, or a combo box so that it only offers what boxes fit the criteria for that specific comic your filing.... hell I could add another field in tblstorageboxes for seriesID so if its a series specifc box it would know what series is in that box when its doing its optimalbox thing.... Id probably need a way to override it though maybe some checkboxes for it to chaneg sorting methods when bringing up a list of boxes? that way I could turn series specific boxes into mixed boxes easier for instance... but then I would need access to recognize I did that and change the label for that box slightly ... WOW this is gonna get complicated lol
 
Last edited:
Yes, it will. That's why one of the first things you always do is sit down and lay out the needs and goals of the project. The idea is to get the tables and contents nailed down before even beginning the actual access file itself.

Sometimes you can even stick to that plan!
 
lol ya I thought I had it planned out but I keep adding :p
 
for the pictures idea you said about making its own table... I coudl use the same table and expand the ability to include series's couldnt I?

For instance have 3 fields, picture attachment, SeriesID, ComicID and then fill in the one that it applies to... a blank field wont hurt anything will it since one of the 2 would be blank
 

Users who are viewing this thread

Back
Top Bottom