当我有 Preserve 关键字时,我不断收到错误,当我将其删除时,我不会收到错误...
我需要保留数组中的数据,因此,如何同时保留并使数组变大。
帮助中的注释说您只能在使用保留时更改最后一个维度,但我不明白这意味着什么......
我的数组设置如下
Public roughPart() 作为字符串
Public roughPartQty() 作为整数
Public topoutPart() 作为字符串
Public topoutPartQty() 作为整数
这是与上述问题相关的代码部分...
Else:
Set blkPart = TempSet(X)
If blkPart.Name = "Assembly" Then
cntAssembly = cntAssembly + 1
For Each attPart In blkPart.GetAttributes
Select Case attPart.TagString
Case "ASSEMBLY":
If attPart.TextString = "" Then
Exit For
Else:
Assembly = attPart.TextString
End If
End Select
Next attPart
'SQLstring = "Select PartID, QTY, AssemblyType From tblAssembly Where AssemblyName ='" & Assembly & "';"
SQLstring = "Select tblAssembly.PartID, tblAssembly.Quantity, tblAssembly.AssemblyType, tblParts.PartName From tblAssembly Inner Join tblParts ON tblAssembly.PartID = tblParts.PartID Where tblAssembly.AssemblyName ='" & Assembly & "';"
Set PlumbingREC = PlumbingDB.OpenRecordset(SQLstring, dbOpenDynaset)
If PlumbingREC.RecordCount > 0 Then
If PlumbingREC.EOF And PlumbingREC.BOF Then
Exit Sub
Else:
PlumbingREC.MoveFirst
Y = 0
Do While Not PlumbingREC.EOF
ReDim roughPart(Y, cntAssembly) As String
ReDim roughPartQty(Y, cntAssembly) As Integer
If PlumbingREC.Fields("AssemblyType").value = "Rough" Then
roughPart(Y, cntAssembly) = PlumbingREC.Fields("PartName").value
roughPartQty(Y, cntAssembly) = PlumbingREC.Fields("Quantity").value
Y = Y + 1
End If
PlumbingREC.MoveNext
Loop
PlumbingREC.MoveFirst
Y = 0
Do While Not PlumbingREC.EOF
ReDim topoutPart(Y, cntAssembly) As String
ReDim topoutPartQty(Y, cntAssembly) As Integer
If PlumbingREC.Fields("AssemblyType").value = "TopOut" Then
topoutPart(Y, cntAssembly) = PlumbingREC.Fields("PartName").value
topoutPartQty(Y, cntAssembly) = PlumbingREC.Fields("Quantity").value
Y = Y + 1
End If
PlumbingREC.MoveNext
Loop
End If
End If
PlumbingREC.Close
Set PlumbingREC = Nothing
我正在尝试执行的操作的摘要:
我有1个块,“程序集”,其中1个属性“程序集”。 该属性的值是存储在 *.mdb 文件中的程序集名称。 因此,我的部件存储在数据库中,而不是存储在块中的多个属性中。
一个组件块可能具有仅引用一个或两个零件的装配体名称,但另一个模块可能具有 20 到 30 个零件。 因此,当我创建(redim)我的数组时...roughPart(X,Y) 第一列中可能只有 2 行数据,然后当查询下一个程序集块并且它有 30 个零件时,该列中将有 30 行。 这是一个问题吗??
提前感谢您的帮助...我希望这足够清楚,如果你需要,我会发布更多细节......
谢谢
本帖以下内容被隐藏保护;需要你回复后,才能看到!
游客,如果您要查看本帖隐藏内容请
回复