In the video Access Expert 1, Lesson 2 you identify the CustomerID, LeadSourceID and ShippingID as a Number in the ContactT but you won't use them in a calculation.
In other lessons you have talked about the difference of text vs numbers types but you don't explain why you are using numbers in this situation as it seems to be inconsistent to the suggested application of the type field.
Can you explain this for me to understand?
Adam Schwanz
@Reply 4 years ago
Those kinds of fields we are making only for Access to use, we use them to setup relationships. CustomerT having the customerID of 1 and for instance, and OrderT with an order for that customer would store CustomerID of 1 as well. This way you can bring in information like name, address, phone, etc from the customer table into that order that you may want to use without storing the customers information a second time in the order table.
You may want to watch Expert 1 a couple of times, relationships are a very important part of a database. You may also want to watch Relationships
While you can use short text primary keys, it's easier to just let access handle that with an autonumber and a number field in the related table.
Tanya CulicOP
@Reply 4 years ago
I understand the relationship. I don't understand why you would change it to a 'number' field type if you are not going to use it 8n a calculation.
Adam Schwanz
@Reply 4 years ago
Numbers are not just for calculations. In the same way you might store a zip code, phone number, or invoice number as a number. If you don't need to use letters or symbols in it, you're almost always better off just making it a number field.
One of the reasons you could want to do this is with sorting. If you use a short text field for numbers, it's not smart enough on its own to count. Instead of doing 1,2,3,4,5,6,7,8,9,10,11 you would get 1,10,11,2,3,4,5,6,7,8,9 because it sees the 1 and puts it ahead of 2 without even looking at the rest of it.
Allan McConnell
@Reply 4 years ago
Ok the way I see it and hope this makes sense is that yes you use number format for calculations, however the one things that is unique about numbers are that they are infinite, and under an Autonumbering will keep spitting out unique numbers
Text on the other hand can be infinite, but relies on the user to supply that unique set of text strings to prevent a duplicate.
Once a record has been assigned a number, it is unique to that record and can be used in other tables to relate back.
Imagine how difficult as user it would be to come up with a unique Text string when your database has over 5000 records?
Adam Schwanz
@Reply 4 years ago
Allan, fun fact, autonumbers aren't actually infinite, theyre a 4 bit long integer. They will stop at 2,147,483,647 (Technically they can go negative to that as well)
Hi Adam. Thank you for that info. I did not know that and that is good to know.
I suppose then, that if the database has 2,147,483,647 records it will still be good to have it as an Auto number and not have to keep typing in numbers or text under a text string. <Smiley Face>
I am loving all the posts and courses and have been using Access for some time now, but I am still learning a lot more. I liken myself to a shirt that needs ironing to smooth out the wrinkles. :-)
Like Adam said, numbers aren't JUST for calculations. I said the way you can differentiate whether or not to choose number or text for a field like phone number, ZIP code, etc. is if you would ever be doing calculations on it. This is a litmus test for natural numbers, things you come across in real life. However KEY FIELDS in your database (primary and foreign) should always be numbers. PKs are AutoNumbers. FKs are Long Integers.
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Access Expert 1.