[AccessD] Inserting a set amount of records into a table

Mark A Matte markamatte at hotmail.com
Thu Feb 10 14:40:24 CST 2005


John,

Could you build a table that has 2 columns...[switchtype] and 
[portnumber]...and basically has 24 records for the 24port switchtype...and 
48 records for the 48port...and then use an append query with that table and 
the table that says what switch type each machine is...filtered by the 
machine id or name...and append to the table where you want the 24 or 48 
ports to be listed.  I believe it is called a "Cartesian product".  
Something like:
SELECT zz_tblSwitchPortsList.Port
FROM zz_tblSwitches, zz_tblSwitchPortsList
WHERE (((zz_tblSwitches.SwitchID)=1) AND 
((zz_tblSwitchPortsList.SwitchType)="48port"));

Since there are 48 records with a switchtype of '48port'...the results would 
be 48 records for switchID 1.

Hope it helps...

Thanks,

Mark






>From: "John Clark" <John.Clark at niagaracounty.com>
>Reply-To: Access Developers discussion and problem 
>solving<accessd at databaseadvisors.com>
>To: <accessd at databaseadvisors.com>
>Subject: [AccessD] Inserting a set amount of records into a table
>Date: Thu, 10 Feb 2005 15:03:35 -0500
>
>I have been whipping up a db to track our routers and switchs, and where
>they are wired to...eventually, I'd like to print a report that would be
>a wire map for a given piece of equipment.
>
>I've got it working pretty well, but I'd like to add one more thing
>before unveiling it. I have a form where each record is a separate piece
>of equipment, and a subform on this form, that will list all ports and
>where they go. Currently I have to enter 24 records for a 24 port switch
>and 48 records if it is a 48 port switch. I would like for it to
>automatically add 24 or 48 records, depending on the value in the
>numPorts field.
>
>I have never done anything like this before, but I am thinking that I
>will need some sort of FOR or DO WHILE loop that cycles through and
>INSERTS a record until it reaches the value of numPorts. Is this the
>gist of it? I really haven't worked with inserting records at all, so if
>there is anything I should know here, I'd appreciate it.
>
>Thanks
>
>John W Clark
>--
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com





More information about the AccessD mailing list