Professional Web Applications Themes

Strange Error Message in A2K - Microsoft Access

Hi, I have a function Today_ATC which calls upon a value returned from qry_ATC2. (qry_ATC2 calculates an average of grouped values from qry_ATC1 - I know this sounds long-winded but I could not see another way.) Function is: Dim RST As ADODB.Recordset Set RST = New ADODB.Recordset RST.Open "qry_ATC2", CurrentProject.Connection, adOpenForwardOnly, adLockOptimistic *** ' populate recordset RST.MoveFirst Today_ATC = RST!Avgofduration RST.Close I have a control on a form which uses this function as its countrolsource. The form recalculates the control at periods using the timer event. For a while it works fine but I eventually get a message box as ...

  1. #1

    Default Strange Error Message in A2K

    Hi,

    I have a function Today_ATC which calls upon a value returned from qry_ATC2.
    (qry_ATC2 calculates an average of grouped values from qry_ATC1 - I know
    this sounds long-winded but I could not see another way.)

    Function is:
    Dim RST As ADODB.Recordset
    Set RST = New ADODB.Recordset
    RST.Open "qry_ATC2", CurrentProject.Connection, adOpenForwardOnly,
    adLockOptimistic ***
    ' populate recordset
    RST.MoveFirst
    Today_ATC = RST!Avgofduration
    RST.Close


    I have a control on a form which uses this function as its countrolsource.
    The form recalculates the control at periods using the timer event.

    For a while it works fine but I eventually get a message box as follows:
    Run Time Error '-2147217900 (80040e14)':

    Invalid SQL Statement: expected 'DELETE', 'INSERT', 'PROCEDURE','SELECT' or
    'UPDATE'

    If I select DEBUG, it takes me to the line shown above (***). In addition, I
    have to close the Access file and re-open, otherwise the error appears
    immediately I open the form again.

    Any ideas anyone? Please!!

    Thanks for any help,

    Jim F.


    Jim Franklin Guest

  2. #2

    Default Strange Error Message in A2K

    Hi,

    I have a function Today_ATC which calls upon a value returned from qry_ATC2.
    (qry_ATC2 calculates an average of grouped values from qry_ATC1 - I know
    this sounds long-winded but I could not see another way.)

    Function is:
    Dim RST As ADODB.Recordset
    Set RST = New ADODB.Recordset
    RST.Open "qry_ATC2", CurrentProject.Connection, adOpenForwardOnly,
    adLockOptimistic ***
    ' populate recordset
    RST.MoveFirst
    Today_ATC = RST!Avgofduration
    RST.Close


    I have a control on a form which uses this function as its countrolsource.
    The form recalculates the control at periods using the timer event.

    For a while it works fine but I eventually get a message box as follows:
    Run Time Error '-2147217900 (80040e14)':

    Invalid SQL Statement: expected 'DELETE', 'INSERT', 'PROCEDURE','SELECT' or
    'UPDATE'

    If I select DEBUG, it takes me to the line shown above (***). In addition, I
    have to close the Access file and re-open, otherwise the error appears
    immediately I open the form again.

    Any ideas anyone? Please!!

    Thanks for any help,

    Jim F.




    Jim Franklin Guest

  3. #3

    Default Re: Strange Error Message in A2K

    make sure you SET RST = Nothing
    after the RST.Close

    any chance the results of ATC1 could return no rows?

    On Fri, 18 Jul 2003 18:26:55 +0100, "Jim Franklin"
    <james.franklinntlworld.com> wrote:
    >Hi,
    >
    >I have a function Today_ATC which calls upon a value returned from qry_ATC2.
    >(qry_ATC2 calculates an average of grouped values from qry_ATC1 - I know
    >this sounds long-winded but I could not see another way.)
    >
    >Function is:
    >Dim RST As ADODB.Recordset
    >Set RST = New ADODB.Recordset
    >RST.Open "qry_ATC2", CurrentProject.Connection, adOpenForwardOnly,
    >adLockOptimistic ***
    >' populate recordset
    >RST.MoveFirst
    >Today_ATC = RST!Avgofduration
    >RST.Close
    >
    >
    >I have a control on a form which uses this function as its countrolsource.
    >The form recalculates the control at periods using the timer event.
    >
    >For a while it works fine but I eventually get a message box as follows:
    >Run Time Error '-2147217900 (80040e14)':
    >
    >Invalid SQL Statement: expected 'DELETE', 'INSERT', 'PROCEDURE','SELECT' or
    >'UPDATE'
    >
    >If I select DEBUG, it takes me to the line shown above (***). In addition, I
    >have to close the Access file and re-open, otherwise the error appears
    >immediately I open the form again.
    >
    >Any ideas anyone? Please!!
    >
    >Thanks for any help,
    >
    >Jim F.
    >
    >
    >
    Bruce Loving Guest

  4. #4

    Default Re: Strange Error Message in A2K

    Hi,

    Thanks Bruce, I will try this. I haven't done this, so what does setting RST
    = Nothing do?

    qry_ATC1 does occasionally return no records - this is fine as the function
    returns a null value, which is not a problem.

    Jim


    "Bruce Loving" <BRUCELOVINGSCENTS.COM> wrote in message
    news:o1kghvsm055sdgmgd4j62nf2955hd0elsh4ax.com...
    > make sure you SET RST = Nothing
    > after the RST.Close
    >
    > any chance the results of ATC1 could return no rows?
    >
    > On Fri, 18 Jul 2003 18:26:55 +0100, "Jim Franklin"
    > <james.franklinntlworld.com> wrote:
    >
    > >Hi,
    > >
    > >I have a function Today_ATC which calls upon a value returned from
    qry_ATC2.
    > >(qry_ATC2 calculates an average of grouped values from qry_ATC1 - I know
    > >this sounds long-winded but I could not see another way.)
    > >
    > >Function is:
    > >Dim RST As ADODB.Recordset
    > >Set RST = New ADODB.Recordset
    > >RST.Open "qry_ATC2", CurrentProject.Connection, adOpenForwardOnly,
    > >adLockOptimistic ***
    > >' populate recordset
    > >RST.MoveFirst
    > >Today_ATC = RST!Avgofduration
    > >RST.Close
    > >
    > >
    > >I have a control on a form which uses this function as its
    countrolsource.
    > >The form recalculates the control at periods using the timer event.
    > >
    > >For a while it works fine but I eventually get a message box as follows:
    > >Run Time Error '-2147217900 (80040e14)':
    > >
    > >Invalid SQL Statement: expected 'DELETE', 'INSERT', 'PROCEDURE','SELECT'
    or
    > >'UPDATE'
    > >
    > >If I select DEBUG, it takes me to the line shown above (***). In
    addition, I
    > >have to close the Access file and re-open, otherwise the error appears
    > >immediately I open the form again.
    > >
    > >Any ideas anyone? Please!!
    > >
    > >Thanks for any help,
    > >
    > >Jim F.
    > >
    > >
    > >
    >

    Jim Franklin Guest

Similar Threads

  1. Strange message at logon
    By Marco in forum Ubuntu
    Replies: 4
    Last Post: May 19th, 06:00 PM
  2. Fink Commander: strange error message in Darwin
    By Jack Mackrel in forum Mac Programming
    Replies: 6
    Last Post: September 22nd, 03:16 AM
  3. Strange error message
    By Joe Myers in forum Microsoft Access
    Replies: 1
    Last Post: August 3rd, 02:23 AM
  4. HELP-Strange message when my site load on net
    By Tuco in forum Macromedia Flash
    Replies: 2
    Last Post: July 6th, 08:34 PM
  5. Strange Message
    By Joe727 in forum Windows Networking
    Replies: 0
    Last Post: July 2nd, 03:23 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139