iNET Interactive - Online Advertising Agency
          
Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > add records to multiple tables(FootballPool)


Reply
 
Thread Tools Display Modes
  #1  
Old 12-29-2003, 10:29 PM
bentfocus bentfocus is offline
Freshman
 
Join Date: Dec 2003
Posts: 27
Default add records to multiple tables(FootballPool)

I have figured out how to add a new record to ONE table in an Access database.
I need to add same records to MULTIPLE tables in same Access database.

In other words...
In my football program wanted to create an add players to pool form.
I have done so, yet can only add records for the new player in one table (Week1, or whatever I put as data source for an ado object).

I have a different table for each week in the nfl season. So Access database has a form "Week1", a form "Week2"...and so on.
Each form has a field "Player name" along with fields:"Pick16" thru"Pick1"
I want my form in VB application to add players to the pool, thereby adding The players name into the "Player name" field in each of the tables representing the 17weeks in an NFL football season.

I hope I've been clear enough...I know that all of you know how difficult it can be to explain what it is that you have trouble with.

Thanks in advance for your help!
Ryan
Reply With Quote
  #2  
Old 12-30-2003, 01:10 AM
CThompson's Avatar
CThompson CThompson is offline
Regular
 
Join Date: Dec 2003
Location: Australia
Posts: 67
Default

Are you writing your code in VBA (if so could I see a snippet) or are you using wizards?
__________________
There are 10 kinds of people in this world, those that understand binary, and those that don't.
Reply With Quote
  #3  
Old 12-30-2003, 02:16 AM
deell deell is offline
Centurion
 
Join Date: Feb 2003
Posts: 185
Default

example:
Code:
Dim db As Database Dim rsWeek As Recordset Dim PName As String 'your player name Set db = OpenDatabase("[your database name]") PName = "..." For i = 1 to 38 'say u have table 'Week1' to 'Week38' rsWeek = db.OpenRecordset("Select * From Week" & i) rsWeek.AddNew rsWeek.Fields("Player Name") = PName rsWeek.Fields("[...]") = [...] [...] rsWeek.Update Next
Reply With Quote
  #4  
Old 12-30-2003, 03:39 PM
bentfocus bentfocus is offline
Freshman
 
Join Date: Dec 2003
Posts: 27
Default

I'm not sure how the code posted above will help.
Where should it be placed?
I am new at this so bear with me...
Reply With Quote
  #5  
Old 12-30-2003, 04:00 PM
gellerche gellerche is offline
Centurion
 
Join Date: Sep 2003
Location: Bloomington, IL
Posts: 168
Default

bentfocus:

One of the more experienced people here may contradict me, but what you are doing is a MAJOR violation of the rules of normalization (Rule #1, I think). Instead of having a separate table for each week, why not add a WeekOfTheYear field to your table, and populate that as you need to? This way, all your queries, reports, etc. can stay the same, instead of needing a separate one for each table.

Steve Geller
Reply With Quote
  #6  
Old 12-30-2003, 05:54 PM
bentfocus bentfocus is offline
Freshman
 
Join Date: Dec 2003
Posts: 27
Default

Ya know,
It actually FELT wrong as I did it that way...waste of space.

I don't really know what Im doing in access or vb, but if I put a WEEKoftheYear field to a table I don't see how I can have each players records show 14-16 picks for each week.
The way it is now, one row corresponds to that player only...14-16 columns across for each winner they pick...one form for each week.
Reply With Quote
  #7  
Old 12-30-2003, 06:00 PM
cmeares cmeares is offline
Contributor
 
Join Date: Sep 2002
Location: anaheim ca
Posts: 408
Default

Quote:
Originally Posted by bentfocus
Ya know,
It actually FELT wrong as I did it that way...waste of space.

I don't really know what Im doing in access or vb, but if I put a WEEKoftheYear field to a table I don't see how I can have each players records show 14-16 picks for each week.
The way it is now, one row corresponds to that player only...14-16 columns across for each winner they pick...one form for each week.



It's mui bueno to have it all in one table. I'm not understanding your table structure though.

YOu mind posting your project / db ?

you can also email it to

theocpcguru at hotmail dot com

i'll look at it.
__________________
Life, it's simply nothing more than a sexually transmitted disease with a 100% mortality rate!
Reply With Quote
  #8  
Old 12-30-2003, 09:15 PM
bentfocus bentfocus is offline
Freshman
 
Join Date: Dec 2003
Posts: 27
Default

Here it is:
Attached Files
File Type: zip PoolProject.zip (32.2 KB, 9 views)
Reply With Quote
  #9  
Old 12-30-2003, 09:17 PM
bentfocus bentfocus is offline
Freshman
 
Join Date: Dec 2003
Posts: 27
Default

Quote:
Originally Posted by CThompson
Are you writing your code in VBA (if so could I see a snippet) or are you using wizards?


I posted the app above...check it out.
Reply With Quote
  #10  
Old 12-30-2003, 10:20 PM
deell deell is offline
Centurion
 
Join Date: Feb 2003
Posts: 185
Default

ya. what gellerche suggests will be better.
Reply With Quote
  #11  
Old 12-31-2003, 07:59 AM
bentfocus bentfocus is offline
Freshman
 
Join Date: Dec 2003
Posts: 27
Default

can someone here reccommend a way for me to create a database that is normalized?
Maybe post a small example for access.
Thanks a bunch!
Reply With Quote
  #12  
Old 12-31-2003, 12:20 PM
gellerche gellerche is offline
Centurion
 
Join Date: Sep 2003
Location: Bloomington, IL
Posts: 168
Default

Quote:
Originally Posted by bentfocus
can someone here reccommend a way for me to create a database that is normalized?
Maybe post a small example for access.
Thanks a bunch!


Here's a link:
http://www.datamodel.org/NormalizationRules.html
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sequential Files - Reading/Displaying Multiple Records buttercup File I/O and Registry 8 08-21-2003 12:32 PM
selecting multiple records Small Mind Database and Reporting 3 05-13-2003 11:02 AM
Adding Multiple records to a table with Single event dpdsouza Database and Reporting 2 11-30-2002 05:29 AM
ListView - Finding Multiple Records? siobahn General 3 10-23-2002 10:25 PM

Advertisement: