(DESKTOP)Use Customer Tables Primary key "ID" in Invoice Table

Hello I’m wondering how i can connect my “ID” in Customer Table to Invoice table to use to keep track of who’s invoice it belongs to and i need to know how to get my Invoice Numbers to AutoIncrease From 102000 . this is where we are left off from the old program we are using. So what I’m trying to do is When you fill out all the info on what kind of shirt you want created it saves all that info in the Database with the “ID” that connects to the customer. my customerDB has 2 Tables : Customer and Invoice . In customer i have all the customers info like Company Name , Full Name, Addresss ect. and in invoice I’m not sure what I’m going to need because I’m taking all the info from my tables that the user filled out and creating an XLS spread sheet to create an invoice to print out but i need to store all the info into my Invoice database just incase we need to change something that the customer wants. So Should i keep all the info from the form or should i just keep the “ID” and “Invoice#” to connect the Customer to the Invoice and Connect the Invoice to the XLS sheet(naming the xls the same as the “Invoice#” ?. Kinda lost on so much to keep track of ! any help any ideas ? examples ?

Thank you
Travis McBride

Try Googling “customer invoice schema” and you’ll get loads of examples of different ways to deal with this.

You will want to look into primary key / foreign key relationships.

example:

[quote=167427:@Rich Hatfield]You will want to look into primary key / foreign key relationships.

example:

[/quote]
Have a question about calling it. can you give me an example . I can see that i use it as a foreign key but not sure how to use it.

Select * from custtable where id=123

Or
Use join custtable on invoive.custid=custtable.id

http://www.tutorialspoint.com/sqlite/sqlite_using_joins.htm