Every time i run my program, a "Run time '381'. Subscript out of range" error occurs on this part of the code:
FlexPP.TextMatrix(RR, 0) = PPDate(RSPartPayment.Fields(2))
Heres the whole code:
Private Sub updGrd()
Dim RR As Integer
SQLPartPayment = "select * from PartPayment Where ReceiptNo = " & txtreceiptno
RSPartPayment.Close
RSPartPayment.Open (SQLPartPayment), connP, adOpenDynamic, adLockOptimistic
FlexPP.Clear
FlexPP.Rows = IIf(RSPartPayment.RecordCount < 0, 1, RSPartPayment.RecordCount + 1)
FlexPP.Cols = RSPartPayment.Fields.count - 1
FlexPP.FixedCols = 0
FlexPP.TextMatrix(0, 0) = "Date"
FlexPP.TextMatrix(0, 1) = "Amount"
FlexPP.TextMatrix(0, 2) = "Post"
If RSPartPayment.EOF Then Exit Sub
RSPartPayment.MoveFirst
RR = 1
Do While Not RSPartPayment.EOF()
FlexPP.TextMatrix(RR, 0) = PPDate(RSPartPayment.Fields(2))
FlexPP.TextMatrix(RR, 1) = Amount(RSPartPayment.Fields(3))
FlexPP.TextMatrix(RR, 2) = IIf(RSPartPayment.Fields(4) = True, "Yes", "No")
RR = RR + 1
Loop
End Sub
I dont see what the problem is cuz I've connected the Flex Grid to MS Access properly and yet, this error still keeps on popping up. I've tried everything but I just dont get why.
I'd really appreciate if anyone could help me out!
Thanks! :)
FlexPP.TextMatrix(RR, 0) = PPDate(RSPartPayment.Fields(2))
Heres the whole code:
Private Sub updGrd()
Dim RR As Integer
SQLPartPayment = "select * from PartPayment Where ReceiptNo = " & txtreceiptno
RSPartPayment.Close
RSPartPayment.Open (SQLPartPayment), connP, adOpenDynamic, adLockOptimistic
FlexPP.Clear
FlexPP.Rows = IIf(RSPartPayment.RecordCount < 0, 1, RSPartPayment.RecordCount + 1)
FlexPP.Cols = RSPartPayment.Fields.count - 1
FlexPP.FixedCols = 0
FlexPP.TextMatrix(0, 0) = "Date"
FlexPP.TextMatrix(0, 1) = "Amount"
FlexPP.TextMatrix(0, 2) = "Post"
If RSPartPayment.EOF Then Exit Sub
RSPartPayment.MoveFirst
RR = 1
Do While Not RSPartPayment.EOF()
FlexPP.TextMatrix(RR, 0) = PPDate(RSPartPayment.Fields(2))
FlexPP.TextMatrix(RR, 1) = Amount(RSPartPayment.Fields(3))
FlexPP.TextMatrix(RR, 2) = IIf(RSPartPayment.Fields(4) = True, "Yes", "No")
RR = RR + 1
Loop
End Sub
I dont see what the problem is cuz I've connected the Flex Grid to MS Access properly and yet, this error still keeps on popping up. I've tried everything but I just dont get why.
I'd really appreciate if anyone could help me out!
Thanks! :)