Hi all,
I am making a database to manage IOs for a PLC configuration. For this purpose I have a table called tblIO_cards which lists all the IO cards I have, has a short text field [Card Tag] containing the unique identifier of the card, and refers to another table tblIO_cardTypes which contains the specifications of each type of IO card, including a number field [IO Count] which indicates how many IOs each card can contain. For example one type of IO card can hold 16 IOs.
Next I have a table IOs where I describe all the IOs and provide details of what is connected to each IO slot on an IO card. In this table there is a relationship field to link each IO to an IO card, and a number field [IO Number] to define on which position on the card the IO is connected. Another field contains the [Variable Name] which is linked to another table where I map the addressing.
However, not every slot in an IO card is used, there are spare slots. I would like to create a query that creates a record for each IO slot in each IO card based on the [IO Count] field, and takes the [Variable Name] from tblIOs for slots which are already assigned, and for slots which are not assigned to an IO, I would like to fill the text "Spare".
For example, if I have an IO card of a certain type that can hold 16 IOs, and I have assigned 11 IOs to it in positions 1,2,3,4,5,6,7,8,12,13,14 in tblIOs, I would like the query to generate 16 records containing the slots in the card numbered from 1 to 16, with a field [Variable name], in which for slots 1,2,3,4,5,6,7,8,12,13,14 it takes the variable name from tblIOs and for slots 9,10,11,15,16 it fills "spare" in the variable name field.
At the moment I am manually creating dummy records in the tblIOs for all slots in a card and assigning the details to the IOs which are used and leaving the others blank, but that's a labour intensive job prone to failure and if I have to add or remove a card.
The reason why I need also the spare slots is because I have created a report that will show an IO overview of each card including spares to indicate cabling, and I want that report to also show spare IOs.
Would appreciate your support.