Welcome to Windows Help!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Simultaneously create records in multiple tables

 
   Windows Help (Home) -> Microsoft Access RSS
Next:  Behavior of "shutdown -f -s" vs. "..  
Author Message
RebeccaKT

External


Since: Dec 2, 2009
Posts: 1



(Msg. 1) Posted: Wed Dec 02, 2009 7:09 am
Post subject: Simultaneously create records in multiple tables
Archived from groups: microsoft>public>access (more info?)

I'm creating a project database for my company in access. We use a specific
Project Number for each of our projects (i.e. 09-01-100).
Each project has so much information that I actually used all the fields in
my first table! It has expanded to four tables that list each project (i.e.
09-01-100) and continue on with that project's information. The primary key
for each table is the Project Number and they are referentially enforced.

My problem is, when I want to add a new project, it needs to be added to all
four tables. It is cumbersome to re-type the project number to each one,
though I found a way to do it even though its referentially enforced.

Is there a macro or some way that I can click a button saying "Add New
Project" type in the new project number once, and Access automatically adds a
record to all four tables?

I don't know programming or fancy language, so please keep directions as
simple as possible! Thank you!

 >> Stay informed about: Simultaneously create records in multiple tables 
Back to top
Login to vote
Dorian

External


Since: Dec 4, 2008
Posts: 6



(Msg. 2) Posted: Wed Dec 02, 2009 7:28 am
Post subject: RE: Simultaneously create records in multiple tables
Archived from groups: per prev. post (more info?)

Yes this can be done, you need to add a command button to a form and have it
run an event procedure as follows:

On Error GoTo ER
CurrentProject.Connection.BeginTrans
CurrentProject.Connection.Execute "INSERT INTO tblTable1 (ProjectNumber)
Values('09-01-100')",,adExecuteNoRecords
CurrentProject.Connection.Execute "INSERT INTO tblTable2 (ProjectNumber)
Values('09-01-100')",,adExecuteNoRecords
CurrentProject.Connection.Execute "INSERT INTO tblTable3 (ProjectNumber)
Values('09-01-100')",,adExecuteNoRecords
CurrentProject.Connection.CommitTrans
Exit Sub
ER:
CurrentProject.Connection.RollbackTrans

I'm assumning the Project number is the primary key of each table.
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".


"RebeccaKT" wrote:

> I'm creating a project database for my company in access. We use a specific
> Project Number for each of our projects (i.e. 09-01-100).
> Each project has so much information that I actually used all the fields in
> my first table! It has expanded to four tables that list each project (i.e.
> 09-01-100) and continue on with that project's information. The primary key
> for each table is the Project Number and they are referentially enforced.
>
> My problem is, when I want to add a new project, it needs to be added to all
> four tables. It is cumbersome to re-type the project number to each one,
> though I found a way to do it even though its referentially enforced.
>
> Is there a macro or some way that I can click a button saying "Add New
> Project" type in the new project number once, and Access automatically adds a
> record to all four tables?
>
> I don't know programming or fancy language, so please keep directions as
> simple as possible! Thank you!

 >> Stay informed about: Simultaneously create records in multiple tables 
Back to top
Login to vote
Roger Carlson

External


Since: May 12, 2009
Posts: 2



(Msg. 3) Posted: Wed Dec 02, 2009 10:30 am
Post subject: Re: Simultaneously create records in multiple tables
Archived from groups: per prev. post (more info?)

Rebecca,

You have a much more severe problem than you even know. If you have so many
fields that you reached the 255 field maximum for a table (and have even
expanded to 4 tables), there are serious design issues with your database.
Continuing with this design will only create more headaches as time goes on.

You need to stop right now and rebuild it from scratch using the principles
of Normalization.

On my website ([URL="http://www.rogersaccesslibrary.com"]www.rogersaccesslibrary.com[/URL]), I have a Database Design
Tutorials section
([URL="http://www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=238"]http://www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=238[/URL]). There
are a few topics that explain Normalization and proper design, followed by
some tutorials that walk you through several projects. I strongly suggest
you take the time to learn the basics. It will save you mounds of work
later.
 >> Stay informed about: Simultaneously create records in multiple tables 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Tables Disappeared - Access2003 on XPproSP2. All of the tables and queries in my database have suddenly disappeared, but the forms can still see the data. I've tried closing and repairing, I've tried importing into a new database - the forms and reports can be imported bu...

Query from 3 tables - I have three tables that I want to put in query. But this is what I need: Articles Stores MinimumQTY ----------- ---------- --------------------- ArticleID StoreID ArticleID..

I'm cryin' here -- please help with pivot tables - I posted the following message yesterday, but got no responses. I'm an infrequent Access user, but I've become so dependent on this group for help when I get stuck. Can anyone give me a little insight? Thanks so much!!! JoLeigh I've been creating..

records for last 6 months - What is a good way to filter a query so it only displays records for the last 6 months ? What I have now in the criteria is <=Date()-182. Is there an easier way to do this? I keep getting an error saying inconsistent datatypes. I'm pretty new to ac...

Entering records on a subform - I have read topics related to my problem but I can't seem to find a solution. I have a form that has a combo box containing events. The records for the combo box come from a query. After selecting an event, a subform is populated with staffing..
   Windows Help (Home) -> Microsoft Access All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]