[AccessD] Is Array the best alternative or do I have options

connie.kamrowski at agric.nsw.gov.au connie.kamrowski at agric.nsw.gov.au
Tue Apr 19 18:24:27 CDT 2005


Having solved the last problem (thanks to some helpful advice from Rocky).
I now move on to the next.


In my Application I must generate reports from parameters passed from the
user. These parameters are start and end Authority Number. That is all
working fine and the customer was happy, but as they are want to do they
have decided they need a change. So now I need to pass these start and end
numbers to a function and see if they have paid their fees and insurance
before allowing the record to be printed. But I also need to present the
user with a list of records that have not been printed because of non
payment.



I have tried to do this by using an Array and then passing the Array back
to a second function to check if the numbers are in the array but I keep
getting a subscript out of range error on my array. I have done a record
count and there should be 383 records in the Array.



Is there a better way to do this? I have posted the start of my code below,
I get a subscript out of range on CheckInsFees


Connie Kamrowski

Analyst/Programmer
Information Technology
NSW Department of Primary Industries
Orange



This message is intended for the addressee named and may contain
confidential information. If you are not the intended recipient or received
it in error, please delete the message and notify sender. Views expressed
are those of the individual sender and are not necessarily the views of
their organisation.



Public Function checkInsFees()
Dim CheckInsFees As Variant
Dim i As Integer
Dim rsCheckFees As Recordset
Dim dbCheckFees As Database
Dim StrSQL As String
Dim intCount As Integer
Dim MyCount As Integer
Dim MyRenewalID As Integer

StrSQL = "SELECT tblDAuthorityRenewal.AuthorityRenewalID FROM
tblDAuthorityRenewal WHERE tblDAuthorityRenewal.FeesPaid = -1 AND
tblDAuthorityrenewal.InsuranceSighted = -1"

Set dbCheckFees = CurrentDb()
    Set rsCheckFees = dbCheckFees.OpenRecordset(StrSQL, dbOpenSnapshot)
    MyCount = rsCheckFees.RecordCount
      CheckInsFees = rsCheckFees.GetRows(MyCount)

    intCount = UBound(CheckInsFees, 2) + 1



ExitRoutine:
    On Error Resume Next
        rsCheckFees.Close
        dbCheckFees.Close

        Set rsCheckFees = Nothing
        Set dbCheckFees = Nothing
    Exit Function

Failure:
        Call ErrorHandler(lngErrorNumber:=Err.Number,
strErrorDescription:=Err.Description, strErrorSource:=Err.Source)
        Resume ExitRoutine



End Function






More information about the AccessD mailing list