473,465 Members | 1,395 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Function for creating/copying table?

36 New Member
Hi all,

I'm trying to create a new table or copy a new table from a template table
but clicking a button in a form.

Sounds complicated? let me explain more

I will have a form were you can login as a user or create a new user
I want in either case you either create a new table for that new user based on a template table that I already made or restrict the user access to his tables only

any way to do that? I can't find a function in access to create or dublicate tables
Nov 26 '06 #1
6 1857
PEB
1,418 Recognized Expert Top Contributor
Hi
You can create a make table query that is run from the respective bouton
the make table query can be like it :

Expand|Select|Wrap|Line Numbers
  1. SELECT "" AS Expr1, "" AS Expr2, "" AS Expr3 INTO test;
  2.  
This query inserts an empty row in the table that you can delete it with delete query and your table test should be empty!
Nov 26 '06 #2
NeoPa
32,556 Recognized Expert Moderator MVP
Please consider carefully whether you want to create a new table for every user.
There certainly are ways of doing it (in SQL as PEB suggests or even using DoCmd.CopyObject()) but it is not an advisable way to go forward in your circumstances.
Consider, instead, adding the new user to a general purpose user table with an identifying key code.

CopyObject Method
The CopyObject method carries out the CopyObject action in Visual Basic.

expression.CopyObject(DestinationDatabase, NewName, SourceObjectType, SourceObjectName)
expression Required. An expression that returns one of the objects in the Applies To list.

DestinationDatabase Optional Variant. A string expression that's the valid path and file name for the database you want to copy the object into. To select the current database, leave this argument blank. Note: In a Microsoft Access project (.adp) you must leave the destinationdatabase argument blank. If you execute Visual Basic code containing the CopyObject method in a library database and leave this argument blank, Microsoft Access copies the object into the library database.

NewName Optional Variant. A string expression that's the new name for the object you want to copy. To use the same name if you are copying into another database, leave this argument blank.

SourceObjectType Optional AcObjectType.

AcObjectType can be one of these AcObjectType constants.
acDataAccessPage
acDefault default
acDiagram
acForm
acFunction
acMacro
acModule
acQuery
acReport
acServerView
acStoredProcedure
acTable
Note When using the CopyObject method with a data access page, a copy of the HTML file for the data access page is created in the Default database folder and a link to it is created in the destination database.


SourceObjectName Optional Variant. A string expression that's the valid name of an object of the type selected by the sourceobjecttype argument. If you run Visual Basic code containing the CopyObject method in a library database, Microsoft Access looks for the object with this name first in the library database, then in the current database.
Nov 26 '06 #3
PEB
1,418 Recognized Expert Top Contributor
Sure a column like UserID can be sutable to insert the information about all users instaed to create a table for each user...

And one table for all i better more easy way to process the data... Else proceed each table.. very heavy algorithme...

The creation of a new rtable is good when you have a very heavy queries... and to facilitate the query work you need to save the information into temporary table.
Nov 26 '06 #4
omozali
36 New Member
Thank all for your input.

I'm trying to create table for every user because it will act as a storage area for other information that are specific for each user. Users will be able this up to add more records
Nov 26 '06 #5
PEB
1,418 Recognized Expert Top Contributor
Yeah man...

I understand.. something like a table for each user...

But you can do also this work adding user_ID and show the information for only the user that put this information Is it possible?

And also u can update his ID automatically without need that he inputs his ID...

So you will have all information from all users at one place... and they will see only introduction from them!
Nov 26 '06 #6
NeoPa
32,556 Recognized Expert Moderator MVP
PEB is absolutely right.
Have a look in here - it's taken from the sticky thread in the Access forum.
How to structure your tables

This site was written by Microsoft for Access 2000. However, the rules basically hold true for any database structure and should be read by anyone building a database who doesn't fully understand the importance of normalisation and how to do it.

So many of the problems our posters encounter can be traced back to the incorrect structure of their tables.

As with all these sites you can ask any questions on the forum if there is anything you don't fully understand.

http://support.microsoft.com/kb/209534/
Nov 26 '06 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: David Bradbury | last post by:
I currently have an iframe on a webpage into which users can insert content. They can further customise the text as I've included buttons such as Bold, Italic, Bullet point etc. This is done along...
5
by: pembed2003 | last post by:
Hi all, I need to write a function to search and replace part of a char* passed in to the function. I came up with the following: char* search_and_replace(char* source,char search,char*...
28
by: Larax | last post by:
Best explanation of my question will be an example, look below at this simple function: function SetEventHandler(element) { // some operations on element element.onclick = function(event) {
2
by: romepatel | last post by:
Hello, I am adding a row dynamically to the table , var table = document.getElementById('example'); var rowCount = table.rows.length; var row = table.insertRow(rowCount); now i want to...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.