How can I...

E

Ed

How can I assign the next correct DO03 channel number and still have the
DO02 channels numbered correctly?

I have a query based on a table: tblSignals.
tblSignals has the folowing fields: SignalName, chassis, slot, chan,
devcodeID, cardType.

The query describes a system that contains several electronic chassis, each
chassis with circuit cards in slots (the slots are numbered), The circuit
card can be different types. All cards have channnels, one channel per
record based on the devcodeID. The DevCode identifies what type of circuit
card goes in the slot. e.g., 'DO03' and 'DO02' identify a DO card. In the
query I do a sort on each column. The channels are numbered. I have a VBA
function that handles this very nicely (shown below).

The problems is that one of the cardType (DO) can take two different
'DevCodes' (DO03 and DO02). The DO cardtype can handle 24 channels (0-23).
Any channel can 'handle' a DO02, but only channels 20 thru 23 can handle a
DO03. The DO03 can be anywhere in the sort. The ------> in the code shows
where I assign the channel number. How can I assign the next correct DO03
channel number and still have the DO02 channels numbered correctly?

The chassis and slot part works OK.

Desired sample output (notice the last record is out of sort order, it was
assigned chan 1, I have to manually change it):

SignalName chassis Slot Chan DEVCODE CardType

Digital Output 98 24 0 DO22 VDOP

Digital Output 98 24 2 DO22 VDOP

Digital Output 98 24 3 DO22 VDOP

SWITCH Command 98 24 4 DO02 VDOP

SWITCH Command 98 24 5 DO02 VDOP

SWITCH Command 98 24 6 DO02 VDOP

SWITCH Command 98 24 7 DO02 VDOP

SWITCH Command 98 24 8 DO02 VDOP

SWITCH Command 98 24 9 DO02 VDOP

SWITCH Command 98 24 10 DO02 VDOP

SWITCH Command 98 24 11 DO02 VDOP

SWITCH Command 98 24 12 DO02 VDOP

SWITCH Command 98 24 13 DO02 VDOP

SWITCH Command 98 24 14 DO02 VDOP

SWITCH Command 98 24 15 DO02 VDOP

SWITCH Command 98 24 16 DO02 VDOP

Digital Output 98 24 20 DO03 VDOP





Public Sub IncChanSlotChassis()
Dim rstWrite As DAO.Recordset

Set rstWrite = CurrentDb.OpenRecordset("qryDAUslotInc", dbOpenDynaset)

iChassis = !Chassis
sCardType = !CardType
iSigCount = getCardCount(!CardType)
iSlot = DLookup("MinOfSlot", "qrySlotFirstChassisNumber", "[Chassis] = "
& iChassis) + 8
Do While Not .EOF
If iChassis <> !Chassis Then
iChassis = !Chassis
iSlot = DLookup("MinOfSlot", "qrySlotFirstChassisNumber",
"[Chassis] = " & iChassis) + 8
ElseIf sCardType <> !CardType Then
iSigCount = getCardCount(!CardType)
sCardType = !CardType
End If
For i = 0 To iSigCount - 1
If sCardType = !CardType Then
.Edit
!Slot = iSlot
------> !Chan = i
.Update
.MoveNext
iCount = iCount + 1
Else
Exit For
End If
If .RecordCount = iCount Then
Exit Do
End If
Next
iSlot = iSlot + 4
Loop
End With
 
T

Tom Ellison

Dear Ed:

As a trained Electrical Engineer, now in the database industry, I may be
able to understand your problem and give some assistance. However, even
with this background, I do not feel I have a beginning feel for what you
need.

You may contact me by email (I use my real email in my messages, an unusual
thing for sure!) If you're interested, perhaps we can get something going.
I'll pass on my phone number and we can talk.

Tom Ellison


Ed said:
How can I assign the next correct DO03 channel number and still have the
DO02 channels numbered correctly?

I have a query based on a table: tblSignals.
tblSignals has the folowing fields: SignalName, chassis, slot, chan,
devcodeID, cardType.

The query describes a system that contains several electronic chassis,
each chassis with circuit cards in slots (the slots are numbered), The
circuit card can be different types. All cards have channnels, one channel
per record based on the devcodeID. The DevCode identifies what type of
circuit card goes in the slot. e.g., 'DO03' and 'DO02' identify a DO card.
In the query I do a sort on each column. The channels are numbered. I have
a VBA function that handles this very nicely (shown below).

The problems is that one of the cardType (DO) can take two different
'DevCodes' (DO03 and DO02). The DO cardtype can handle 24 channels (0-23).
Any channel can 'handle' a DO02, but only channels 20 thru 23 can handle a
DO03. The DO03 can be anywhere in the sort. The ------> in the code shows
where I assign the channel number. How can I assign the next correct DO03
channel number and still have the DO02 channels numbered correctly?

The chassis and slot part works OK.

Desired sample output (notice the last record is out of sort order, it was
assigned chan 1, I have to manually change it):

SignalName chassis Slot Chan DEVCODE CardType

Digital Output 98 24 0 DO22 VDOP

Digital Output 98 24 2 DO22 VDOP

Digital Output 98 24 3 DO22 VDOP

SWITCH Command 98 24 4 DO02 VDOP

SWITCH Command 98 24 5 DO02 VDOP

SWITCH Command 98 24 6 DO02 VDOP

SWITCH Command 98 24 7 DO02 VDOP

SWITCH Command 98 24 8 DO02 VDOP

SWITCH Command 98 24 9 DO02 VDOP

SWITCH Command 98 24 10 DO02 VDOP

SWITCH Command 98 24 11 DO02 VDOP

SWITCH Command 98 24 12 DO02 VDOP

SWITCH Command 98 24 13 DO02 VDOP

SWITCH Command 98 24 14 DO02 VDOP

SWITCH Command 98 24 15 DO02 VDOP

SWITCH Command 98 24 16 DO02 VDOP

Digital Output 98 24 20 DO03 VDOP





Public Sub IncChanSlotChassis()
Dim rstWrite As DAO.Recordset

Set rstWrite = CurrentDb.OpenRecordset("qryDAUslotInc", dbOpenDynaset)

iChassis = !Chassis
sCardType = !CardType
iSigCount = getCardCount(!CardType)
iSlot = DLookup("MinOfSlot", "qrySlotFirstChassisNumber", "[Chassis] =
" & iChassis) + 8
Do While Not .EOF
If iChassis <> !Chassis Then
iChassis = !Chassis
iSlot = DLookup("MinOfSlot", "qrySlotFirstChassisNumber",
"[Chassis] = " & iChassis) + 8
ElseIf sCardType <> !CardType Then
iSigCount = getCardCount(!CardType)
sCardType = !CardType
End If
For i = 0 To iSigCount - 1
If sCardType = !CardType Then
.Edit
!Slot = iSlot
------> !Chan = i
.Update
.MoveNext
iCount = iCount + 1
Else
Exit For
End If
If .RecordCount = iCount Then
Exit Do
End If
Next
iSlot = iSlot + 4
Loop
End With
 
E

Ed

Thanks Tom

I did not solve this problem, but I resolved the issue using another
solution which proved acceptable.

Ed

Tom Ellison said:
Dear Ed:

As a trained Electrical Engineer, now in the database industry, I may be
able to understand your problem and give some assistance. However, even
with this background, I do not feel I have a beginning feel for what you
need.

You may contact me by email (I use my real email in my messages, an
unusual thing for sure!) If you're interested, perhaps we can get
something going. I'll pass on my phone number and we can talk.

Tom Ellison


Ed said:
How can I assign the next correct DO03 channel number and still have the
DO02 channels numbered correctly?

I have a query based on a table: tblSignals.
tblSignals has the folowing fields: SignalName, chassis, slot, chan,
devcodeID, cardType.

The query describes a system that contains several electronic chassis,
each chassis with circuit cards in slots (the slots are numbered), The
circuit card can be different types. All cards have channnels, one
channel per record based on the devcodeID. The DevCode identifies what
type of circuit card goes in the slot. e.g., 'DO03' and 'DO02' identify a
DO card. In the query I do a sort on each column. The channels are
numbered. I have a VBA function that handles this very nicely (shown
below).

The problems is that one of the cardType (DO) can take two different
'DevCodes' (DO03 and DO02). The DO cardtype can handle 24 channels
(0-23). Any channel can 'handle' a DO02, but only channels 20 thru 23 can
handle a DO03. The DO03 can be anywhere in the sort. The ------> in the
code shows where I assign the channel number. How can I assign the next
correct DO03 channel number and still have the DO02 channels numbered
correctly?

The chassis and slot part works OK.

Desired sample output (notice the last record is out of sort order, it
was assigned chan 1, I have to manually change it):

SignalName chassis Slot Chan DEVCODE CardType

Digital Output 98 24 0 DO22 VDOP

Digital Output 98 24 2 DO22 VDOP

Digital Output 98 24 3 DO22 VDOP

SWITCH Command 98 24 4 DO02 VDOP

SWITCH Command 98 24 5 DO02 VDOP

SWITCH Command 98 24 6 DO02 VDOP

SWITCH Command 98 24 7 DO02 VDOP

SWITCH Command 98 24 8 DO02 VDOP

SWITCH Command 98 24 9 DO02 VDOP

SWITCH Command 98 24 10 DO02 VDOP

SWITCH Command 98 24 11 DO02 VDOP

SWITCH Command 98 24 12 DO02 VDOP

SWITCH Command 98 24 13 DO02 VDOP

SWITCH Command 98 24 14 DO02 VDOP

SWITCH Command 98 24 15 DO02 VDOP

SWITCH Command 98 24 16 DO02 VDOP

Digital Output 98 24 20 DO03 VDOP





Public Sub IncChanSlotChassis()
Dim rstWrite As DAO.Recordset

Set rstWrite = CurrentDb.OpenRecordset("qryDAUslotInc", dbOpenDynaset)

iChassis = !Chassis
sCardType = !CardType
iSigCount = getCardCount(!CardType)
iSlot = DLookup("MinOfSlot", "qrySlotFirstChassisNumber", "[Chassis] =
" & iChassis) + 8
Do While Not .EOF
If iChassis <> !Chassis Then
iChassis = !Chassis
iSlot = DLookup("MinOfSlot", "qrySlotFirstChassisNumber",
"[Chassis] = " & iChassis) + 8
ElseIf sCardType <> !CardType Then
iSigCount = getCardCount(!CardType)
sCardType = !CardType
End If
For i = 0 To iSigCount - 1
If sCardType = !CardType Then
.Edit
!Slot = iSlot
------> !Chan = i
.Update
.MoveNext
iCount = iCount + 1
Else
Exit For
End If
If .RecordCount = iCount Then
Exit Do
End If
Next
iSlot = iSlot + 4
Loop
End With
 
Top