tesla764
asked on
vb6 run time error '381' Invalid property array index.
When I run the code seen below, I get the Run Time error '381' Invalid property array index. The line the debugger points to is...
.fields("fo_rackType") = Me.cboRackType.ItemData(Me .cboRackTy pe.ListInd ex)
Any ideas on how to fix this error? Thanks in Advance,
Here's the code...
Private Sub cmdInsert_Click()
'take the current Zone that you are on, then make the endZone the
'endZone of the new Zone. Have the user pick tHe beginning zone and
'make the end of the old zone the zone prior to the beginning of the
'new zone
Dim lngZoneNumb As Long
Dim rowZoneRow As Integer
Dim strZoneCode As String
Dim strZoneLoc As String
If Not rsZoneConfig.EOF Then
If Not Trim(rsZoneConfig.fields(" StartZoneC ode")) = Trim(rsZoneConfig.fields(" endZoneCod e")) Then
'flag that this PickZone Configuration has changed
Me.cboPickZoneName.ItemDat a(Me.cboPi ckZoneName .ListIndex ) = 1
lngZoneNumb = rsZoneConfig.fields("ZoneN umber") + 1
rowZoneRow = Me.grdZoneConfig.Row
strZoneCode = Trim(rsZoneConfig.fields(" endZoneCod e"))
strZoneLoc = Trim(rsZoneConfig.fields(" endZoneLoc "))
rsZoneConfig.MoveNext
If Not rsZoneConfig.EOF Then
rsZoneConfig.fields("ZoneN umber") = rsZoneConfig.fields("ZoneN umber") + 1
End If
With rsZoneConfig
.AddNew
.fields("ZoneNumber") = lngZoneNumb
.fields("EndZoneCode") = strZoneCode
.fields("EndZoneLoc") = strZoneLoc
.fields("fo_building") = Me.cboBuilding.ItemData(Me .cboBuildi ng.ListInd ex)
.fields("fo_rackType") = Me.cboRackType.ItemData(Me .cboRackTy pe.ListInd ex)
.fields("ZoneName") = Trim(Me.cboPickZoneName.Te xt)
.fields("ZoneQty") = 0
.fields("PacksNeeded") = 0
.fields("UnitsNeeded") = 0
End With
'reset the Zone numbers
rsZoneConfig.MoveNext
Dim icount As Long
icount = lngZoneNumb + 1
While Not rsZoneConfig.EOF
rsZoneConfig.fields("ZoneN umber") = icount
rsZoneConfig.MoveNext
icount = icount + 1
Wend
rsZoneConfig.Sort = "ZoneName, fo_building, fo_rackType, ZoneNumber"
Me.grdZoneConfig.Refresh
Me.grdZoneConfig.Row = rowZoneRow + 1
Call grdZoneConfig_ButtonClick( 1)
Else
MsgBox "You can not insert a Zone Here", vbExclamation, "Pick Zone Configuration"
End If
End If
End Sub
.fields("fo_rackType") = Me.cboRackType.ItemData(Me
Any ideas on how to fix this error? Thanks in Advance,
Here's the code...
Private Sub cmdInsert_Click()
'take the current Zone that you are on, then make the endZone the
'endZone of the new Zone. Have the user pick tHe beginning zone and
'make the end of the old zone the zone prior to the beginning of the
'new zone
Dim lngZoneNumb As Long
Dim rowZoneRow As Integer
Dim strZoneCode As String
Dim strZoneLoc As String
If Not rsZoneConfig.EOF Then
If Not Trim(rsZoneConfig.fields("
'flag that this PickZone Configuration has changed
Me.cboPickZoneName.ItemDat
lngZoneNumb = rsZoneConfig.fields("ZoneN
rowZoneRow = Me.grdZoneConfig.Row
strZoneCode = Trim(rsZoneConfig.fields("
strZoneLoc = Trim(rsZoneConfig.fields("
rsZoneConfig.MoveNext
If Not rsZoneConfig.EOF Then
rsZoneConfig.fields("ZoneN
End If
With rsZoneConfig
.AddNew
.fields("ZoneNumber") = lngZoneNumb
.fields("EndZoneCode") = strZoneCode
.fields("EndZoneLoc") = strZoneLoc
.fields("fo_building") = Me.cboBuilding.ItemData(Me
.fields("fo_rackType") = Me.cboRackType.ItemData(Me
.fields("ZoneName") = Trim(Me.cboPickZoneName.Te
.fields("ZoneQty") = 0
.fields("PacksNeeded") = 0
.fields("UnitsNeeded") = 0
End With
'reset the Zone numbers
rsZoneConfig.MoveNext
Dim icount As Long
icount = lngZoneNumb + 1
While Not rsZoneConfig.EOF
rsZoneConfig.fields("ZoneN
rsZoneConfig.MoveNext
icount = icount + 1
Wend
rsZoneConfig.Sort = "ZoneName, fo_building, fo_rackType, ZoneNumber"
Me.grdZoneConfig.Refresh
Me.grdZoneConfig.Row = rowZoneRow + 1
Call grdZoneConfig_ButtonClick(
Else
MsgBox "You can not insert a Zone Here", vbExclamation, "Pick Zone Configuration"
End If
End If
End Sub
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for you patience.