Results 1 to 11 of 11
  1. #1
    New Lounger
    Join Date
    Jul 2007
    Location
    Wytheville, Virginia, USA
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Array Error (Access 2002-2003)

    I am am having problems with array script and need help. I am on a project deadline and can't get this fixed. I have a form with several check boxes on it and it was working fine. I had to add a section and then started getting this. "Run-time Error '9' : Subscript out of range". I have included all of the code and indicated where the error occurs with *** page left. PLEASE HELP SOON!!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Array Error (Access 2002-2003)

    Welcome to Woody's Lounge!

    In the Form_Open event procedure, you populate the arrays. The array arrChk6 should be filled with the names "AS6", "Check114", "Check120", and "Check124". Are you absolutely sure that these four names actually occur as control names on the form? (Check the spelling carefully!)

  3. #3
    New Lounger
    Join Date
    Jul 2007
    Location
    Wytheville, Virginia, USA
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Array Error (Access 2002-2003)

    Hans, Thank you for the Welcome. Actually, I had made a change the "1 to 4" line should read "1 to 3" since there is only three variables. Also, yes, the array for AS6 should be Check114, Check120, Check124 as these are the names for the 3 check boxes I an trying to verify. I have, since the posting, deleted all baxes and created new ones and that seems to help some problems but I am still getting the error I spoke of earlier when I click the AS6 box. It should clear all 3 boxes, like a reset, and that's when the error occurs.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Array Error (Access 2002-2003)

    If you have checked the number and names of the check boxes, it's impossible to know what causes the error without seeing the database. Could you post a stripped down copy of your database? See <post#=401925>post 401925</post#> for instructions.

  5. #5
    New Lounger
    Join Date
    Jul 2007
    Location
    Wytheville, Virginia, USA
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Array Error (Access 2002-2003)

    Hans,
    I got it. I was had a double quote. It's always, well mostly always, something simple huh? Hey tell me something. I have a DB that I need to delete the records from a table and update it from multiple DB each time it opens. Anysuggestions on what to do and do you any VBscript?

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Array Error (Access 2002-2003)

    I would prepare a series of queries:
    - A delete query to delete the records from the table.
    - An append query for each external source to add records.

    There are two ways you can run the queries automatically when the database is opened:
    - By creating a macro named AutoExec. You can use the OpenQuery action to run the queries.
    - By putting code in the On Open event of a form, using DoCmd.OpenQuery to run the queries. Set the form as startup form in Tools | Startup...

  7. #7
    New Lounger
    Join Date
    Jul 2007
    Location
    Wytheville, Virginia, USA
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Array Error (Access 2002-2003)

    I tried the macro method but I don't wwant ppl to fight the dialog boxes. So the code is how I was trying to go. I tried the DoCmd.OpenQuery but I am having trouble with the string. I am not that good with VB and I'm not putting it in correctly. How would it look AFTER the DoCmd.OpenQuery? DoCmd.OpenQuery (????...

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Array Error (Access 2002-2003)

    You can use the SetWarnings action with argument No at the beginning of the macro to suppress the warning "You are about to ...". Don't forget to use SetWarnings with argument Yes at the end.

    In VBA, you'd use

    DoCmd.SetWarnings False
    DoCmd.OpenQuery "NameOfFirstQuery"
    DoCmd.OpenQuery "NameOfSecondQuery"
    ...
    DoCmd.SetWarnings True

  9. #9
    New Lounger
    Join Date
    Jul 2007
    Location
    Wytheville, Virginia, USA
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Array Error (Access 2002-2003)

    AWESOME
    I'll try that. THANKS for ALL of your help.

  10. #10
    New Lounger
    Join Date
    Jul 2007
    Location
    Wytheville, Virginia, USA
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Array Error (Access 2002-2003)

    Hey man. First, how did you get so good ith VBA? I do have another question if you don't mind. If you do that's okay.
    The question is this.
    How can I have a button on a switchboard or form, ACTIVATE a hyperlink?
    Thanks so much, you da man.

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Array Error (Access 2002-2003)

    I learned a lot from Woody's Lounge (especially from <!profile=Charlotte>Charlotte<!/profile>) before I became a member myself. And I find a lot by experimenting and searching.

    If you use a standard command button, you can use FollowHyperlink, for example:
    <code>
    Private Sub cmdTest_Click()
    Application.FollowHyperlink "http://www.wopr.com"
    End Sub
    </code>
    If you're using a switchboard created by the Switchboard Manager, you can only assign specific actions to the switchboard items. You can create a module by clicking New in the Modules section of the database window, and write a function:
    <code>
    Public Function ActivateLink()
    Application.FollowHyperlink "http://www.wopr.com"
    End Function
    </code>
    In the Switchboard Manager, specify Run Code as command, and enter ActivateLink in the Function box.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •