Results 1 to 5 of 5
  1. #1
    Join Date
    May 2012
    Posts
    132

    Unanswered: an error in a form!

    I made a form over a query and added a button to go and view next records. Then I added two unbound text boxes named: delay1 and delay2. Then I put this code in the visual basic:

    Sub delay1_AfterUpdate()
    Me.delay2 = 4
    End Sub

    The above code works only for the first record of the query.when I push the “next” button, It does not work for next records and l see the following error uppon updating the text box delay1:

    “The expression after update you entered was the event property setting produced error: A problem occurred while Microsoft access was communicating with the OLE server or ActiveX control.
    This error occurs when an event has failed to run because the location of the logic for the event cannot be evaluated. For example, if the OnOpen property of a form is set to = [Field], this error occurs because a macro or event name is expected to run when the event occurs.”
    I would appreciate any guide and comment.
    Thank you
    Last edited by ariansman; 04-30-13 at 09:16.
    ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    I asked god to please give me everything to enjoy the life, God said: i gave you the life to enjoy everything.

  2. #2
    Join Date
    May 2012
    Posts
    132
    why there is no answer to this question?
    ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    I asked god to please give me everything to enjoy the life, God said: i gave you the life to enjoy everything.

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    "A problem occurred while Microsoft access was communicating with the OLE server or ActiveX control"

    is arguably the most useless error message Access ever throws, with

    "This error occurs when an event has failed to run because the location of the logic for the event cannot be evaluated"

    being just one of many actual causes!

    Simply moving to another Record will not cause the delay1_AfterUpdate event to fire. To get it to do so, when moving to another Record, would need to be Called from the OnCurrent event:

    Code:
    Private Sub Form_Current()
     Call delay1_AfterUpdate
    End Sub
    But I have to tell you that doing this, with both delay1 and delay2 being Unbound Controls, makes little sense, on the face of it. Perhaps if you could give us an explanation of exactly what you're trying to do here, in plain language, we could offer you better advice.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    May 2012
    Posts
    132
    Thank you linq,
    I am confused as I have always used this code in similar situations and it has been working.
    I used those unbound textboxes and referring merely to a number to simplify the problem and see that it still is not working. In other words “afterupdat” or “change” does not work. It seems these codes only works if a form is built over a table and if it is built over a query it does not work. Is that true?
    Plus I also saw a second problem as following:
    Here is a simplified of what I am doing and also the other problem. I made a form, named formA over a query with about 3 blanks: txt1, txt2 and txt3. While formA is open, pushing a bottom a new form is opened named formB, which one of its blanks should be filed automatically exactly with the same data as in formA when a blank named txt1 is updated/changes. I have put this code in formB:
    Private Sub txt1_AfterUpdate()
    Me!txt2 = Forms![formA]![txt2]
    End Sub
    By updating txt1 in formB access prompts me to debug, saying: Microsoft office cannot find the referenced form “FormA”. I am coming to the idea that both problems are made because formA is made on a query, because this code works if FormA was a form made over a table.
    Thank you
    ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    I asked god to please give me everything to enjoy the life, God said: i gave you the life to enjoy everything.

  5. #5
    Join Date
    May 2012
    Posts
    132
    i rebuilt it again and now it is working, i could not find what caused that problem though.
    ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
    I asked god to please give me everything to enjoy the life, God said: i gave you the life to enjoy everything.

Posting Permissions

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