HI,
I have been trying to figure out why my code wont pic up the data and write it to the array's I've created.
Code below.
This code is run from and button Click, in Form called Master. This Form contains subForms using the data records from the tables Refurbs and Uprades.
Any ideas would be great.
m_Property = Form_Master.m_Property
m_recdel = " "
m_DateComp = Form_Property1.Date_Completed
' ******************** Take Data from Existing Tables and place in Array
Me.RecordSource = "Refurbs"
Me.SetFocus
If IsNull(ID) = False Then
Me.FilterOn = True
Me.Filter = "Property Like '" & m_Property & "'"
m_records = Recordset.RecordCount
m_RecCount = 0
Do While True
a_Property(m_LineCount) = m_Property
a_DateComp(m_LineCount) = m_DateComp
a_LineType(m_LineCount) = "R1"
a_Ref(m_LineCount) = Ref
a_Desc(m_LineCount) = Description
a_Claim(m_LineCount) = Claim
a_Cost(m_LineCount) = Cost
If m_records = m_RecCount Then
Exit Do
End If
m_RecCount = m_RecCount + 1
DoCmd.GoToRecord , , acNext
m_LineCount = m_LineCount + 1
Loop
Else
DoCmd.CancelEvent
End If
Me.RecordSource = "R_Notes"
Me.SetFocus
If IsNull(ID) = False Then
Me.FilterOn = True
Me.Filter = "Property Like '" & m_Property & "'"
m_records = Recordset.RecordCount
m_RecCount = 0
Do While True
a_Property(m_LineCount) = m_Property
a_Ref(m_LineCount) = Ref
a_Desc(m_LineCount) = Description
a_LineType(m_LineCount) = "R2"
If m_records = m_RecCount Then
Exit Do
End If
m_RecCount = m_RecCount + 1
DoCmd.GoToRecord , , acNext
m_LineCount = m_LineCount + 1
Loop
Else
DoCmd.CancelEvent
End If
Me.RecordSource = "Upgrades"
SetFocus
If IsNull(ID) = False Then
Me.FilterOn = True
Me.Filter = "Property Like '" & m_Property & "'"
m_records = Recordset.RecordCount
m_RecCount = 0
Do While True
a_Property(m_LineCount) = m_Property
a_DateComp(m_LineCount) = m_DateComp
a_Ref(m_LineCount) = Ref
a_Desc(m_LineCount) = Description
a_Claim(m_LineCount) = Claim
a_Cost(m_LineCount) = Cost
a_LineType(m_LineCount) = "U1"
If m_records = m_RecCount Then
Exit Do
End If
m_RecCount = m_RecCount + 1
DoCmd.GoToRecord , , acNext
m_LineCount = m_LineCount + 1
Loop
Else
DoCmd.CancelEvent
End If
Me.RecordSource = "U_Notes"
Me.SetFocus
If IsNull(ID) = False Then
Me.FilterOn = True
Me.Filter = "Property Like '" & m_Property & "'"
m_records = Recordset.RecordCount
m_RecCount = 0
Do While True
a_Property(m_LineCount) = m_Property
a_Ref(m_LineCount) = Ref
a_Desc(m_LineCount) = Description
a_LineType(m_LineCount) = "U2"
If m_records = m_RecCount Then
Exit Do
End If
m_RecCount = m_RecCount + 1
DoCmd.GoToRecord , , acNext
m_LineCount = m_LineCount + 1
Loop
Else
DoCmd.CancelEvent
End If
' ******************** Take Data from Arrays and Place in Report Table
m_LastLine = m_LineCount
m_LineCount = 0
Me.RecordSource = "P_JobSheet"
Me.SetFocus
Do While True
Property = a_Property(m_LineCount)
DateComp = a_DateComp(m_LineCount)
Ref = a_Ref(m_LineCount)
Desc = a_Desc(m_LineCount)
Qty = a_Claim(m_LineCount)
Cost = a_Cost(m_LineCount)
TLineType = a_LineType(m_LineCount)
If m_LineCount > m_LastLine = True Then
Exit Do
End If
DoCmd.GoToRecord , , acNewRec
m_LineCount = m_LineCount + 1
Loop
DoCmd.Close
End Sub
Thanks! Jim
I have been trying to figure out why my code wont pic up the data and write it to the array's I've created.
Code below.
This code is run from and button Click, in Form called Master. This Form contains subForms using the data records from the tables Refurbs and Uprades.
Any ideas would be great.
m_Property = Form_Master.m_Property
m_recdel = " "
m_DateComp = Form_Property1.Date_Completed
' ******************** Take Data from Existing Tables and place in Array
Me.RecordSource = "Refurbs"
Me.SetFocus
If IsNull(ID) = False Then
Me.FilterOn = True
Me.Filter = "Property Like '" & m_Property & "'"
m_records = Recordset.RecordCount
m_RecCount = 0
Do While True
a_Property(m_LineCount) = m_Property
a_DateComp(m_LineCount) = m_DateComp
a_LineType(m_LineCount) = "R1"
a_Ref(m_LineCount) = Ref
a_Desc(m_LineCount) = Description
a_Claim(m_LineCount) = Claim
a_Cost(m_LineCount) = Cost
If m_records = m_RecCount Then
Exit Do
End If
m_RecCount = m_RecCount + 1
DoCmd.GoToRecord , , acNext
m_LineCount = m_LineCount + 1
Loop
Else
DoCmd.CancelEvent
End If
Me.RecordSource = "R_Notes"
Me.SetFocus
If IsNull(ID) = False Then
Me.FilterOn = True
Me.Filter = "Property Like '" & m_Property & "'"
m_records = Recordset.RecordCount
m_RecCount = 0
Do While True
a_Property(m_LineCount) = m_Property
a_Ref(m_LineCount) = Ref
a_Desc(m_LineCount) = Description
a_LineType(m_LineCount) = "R2"
If m_records = m_RecCount Then
Exit Do
End If
m_RecCount = m_RecCount + 1
DoCmd.GoToRecord , , acNext
m_LineCount = m_LineCount + 1
Loop
Else
DoCmd.CancelEvent
End If
Me.RecordSource = "Upgrades"
SetFocus
If IsNull(ID) = False Then
Me.FilterOn = True
Me.Filter = "Property Like '" & m_Property & "'"
m_records = Recordset.RecordCount
m_RecCount = 0
Do While True
a_Property(m_LineCount) = m_Property
a_DateComp(m_LineCount) = m_DateComp
a_Ref(m_LineCount) = Ref
a_Desc(m_LineCount) = Description
a_Claim(m_LineCount) = Claim
a_Cost(m_LineCount) = Cost
a_LineType(m_LineCount) = "U1"
If m_records = m_RecCount Then
Exit Do
End If
m_RecCount = m_RecCount + 1
DoCmd.GoToRecord , , acNext
m_LineCount = m_LineCount + 1
Loop
Else
DoCmd.CancelEvent
End If
Me.RecordSource = "U_Notes"
Me.SetFocus
If IsNull(ID) = False Then
Me.FilterOn = True
Me.Filter = "Property Like '" & m_Property & "'"
m_records = Recordset.RecordCount
m_RecCount = 0
Do While True
a_Property(m_LineCount) = m_Property
a_Ref(m_LineCount) = Ref
a_Desc(m_LineCount) = Description
a_LineType(m_LineCount) = "U2"
If m_records = m_RecCount Then
Exit Do
End If
m_RecCount = m_RecCount + 1
DoCmd.GoToRecord , , acNext
m_LineCount = m_LineCount + 1
Loop
Else
DoCmd.CancelEvent
End If
' ******************** Take Data from Arrays and Place in Report Table
m_LastLine = m_LineCount
m_LineCount = 0
Me.RecordSource = "P_JobSheet"
Me.SetFocus
Do While True
Property = a_Property(m_LineCount)
DateComp = a_DateComp(m_LineCount)
Ref = a_Ref(m_LineCount)
Desc = a_Desc(m_LineCount)
Qty = a_Claim(m_LineCount)
Cost = a_Cost(m_LineCount)
TLineType = a_LineType(m_LineCount)
If m_LineCount > m_LastLine = True Then
Exit Do
End If
DoCmd.GoToRecord , , acNewRec
m_LineCount = m_LineCount + 1
Loop
DoCmd.Close
End Sub
Thanks! Jim