Create a Table on a button click

aBheE

New member
Local time
Today, 13:15
Joined
Dec 8, 2009
Messages
9
Can any one help me on this issue? i searched on the internet and on this forum. i coudnt find ne solution.
My problem is i have to create this archive and they want me to select a rack number from a storage location. As a beginner the way i could think of doing this is by creating different tables for different locations so there will be unique rack numbers. can some one help me with this. If I can create a table using a button on a form will help me. If this is not possible on access can some one advice me on another way of doing this. please.
 
You can create tables using a Make Table Query.

However I don't fully understand exactly what you are trying to do, so it is difficult to say if this is the path to take (I suspect not).

Could you outline, step by step, what it is you are trying to do and achieve as your end result.
 
its lyk dis.
i am suppose to make a system which records details of some files in this company.
they have like 3 buildings in 3 cities. and each building has racks. they want a
specific rack number which will be unique and shud be able 2 know which building and
which rack by just reading the ack number. so for example i have buildings in
birmingham, salford and nottingham. And i have racks as A1, A2, B1, B2
the rack number filed either should be BIRMA1, SALFA1 o smthng like that. but all the
user will have 2 do shud be select the city and the rack numbers should update
according to the building location.

The way i could think of doing this was create a different table for each and every
location. but the user wants to add another location in the future. so he wants a
button called "Add Location". so according to the way i am tryna do this i will have to
create a table for each time he clicks "Add Location". I want to know how to create
a table on a button click or another way of doing this. And queries take details from existing tables and create a view yea? what i want to do is create a whole new table.
hope i am clear. if not i will defntly explain it again.
please help!
thank u in advance
 
Making separate tables is not the way.
Your table should include a field which stores the BuildingID and RackID as foreign keys to a table of with information about the building and the racks.

Adding a location or a rack means adding records to the Building or Rack Tables.

Reading or writing information in the main table about what is in the racks uses Sa WHERE clause with the BuildingID or RackID specified.
 
ohh.. ok... thank u very much. Can u tell me how do i make the system to

automatically generate the rack IDs with the first 3 letters of the location

name? as in like if the location is salford and the rack number is A01 I want the

rack id to be SALA01. and i want it to generate automaticcally.

if there is a way like writing somethng in the format field of the ''field prperties" in table desgin view

would be great.

please help.

thanks.
 
I would keep the LocationIDs and RackIDs as spearate fields.

Generate the combined code for display on the forms by concatenating the information in the fields with the control source of a textbox on the form.

If using letter codes for the Primary Key of the buildings it is as simple as: = BuildingID & RackID

If using numeric building code you just need to adjust the record source query to pull the letter code of the building as well as the numeric ID.
 
To automatically generate the complete code from the name

= Left([LocationName], 3) & RackID

With a hypen (or anyother text using quotes if you want):

= Left([LocationName], 3) & "-" & RackID
 

Users who are viewing this thread

Back
Top Bottom