Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I setup a new Access database from a template using VB?

Status
Not open for further replies.

MarcMellor

Programmer
Jan 12, 2002
34
0
0
US
I have a database table set up in Access as a Template, named "MyResults". It contains about 20 fields and 360 rows with empty records. When a new user registers, I want to be able to make a copy of this template and name it UserCode & "Results" so that when they log on the Data1 control will be able to make a connection to this database to deposite results in it.
Any ideas?
I am an absolute amateur in VB so please keep it simple and complete!!
 
If you proceed as you have planned you will end up with a huge database that contains almost nothing. A couple of tips; try not to create multiple tables that store the same information, don't create recored unless there is information to place into the records.

This is what I would do.
1. Create two tables in Access (users and results).
2. Foriegn key in results relates to primary key in Users (field: UserID)
3. Use a query to extract only the data for the logged in user.
4. Use that query as the data source for your control.

The data1 control will allow the addition of new records. so you don't have to have any predetermined number of rows.

Keeping the information in one table will slow down the query a bit, but the users won't notice the difference for a while.

Also consider that Access has a size limitation, I believe 1 gig, and if you have lots of empty records they will still take up space. If you have 100 users with 1 result each you only need 200 records in my database (1 in each of my two tables), your way will produce 36000 records in 101 tables (1 per user plus the template). Right away your database is 180 times the size of mine. Thanks and Good Luck!

zemp
 
Thanks, Zemp,
but I will need a separate table for each person because over time all of the records will get filled and they will all relate to one person only. This is because it builds up a score for each type of question(360 rows), answered correctly(fields), the total attempted (fields) of that type, and each of these at 3 different levels (fields). I would have to have a 3-dimensional table to to include a user name. I am only expecting small numbers of users, 3 or 4 at most and the total number of records will not increase, they will just get filled.
So as far as I can see I'm still stuck with copying and then re-naming my template!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top