dBforums

dBforums (http://www.dbforums.com/)
-   Microsoft Access (http://www.dbforums.com/microsoft-access/)
-   -   an error in a form! (http://www.dbforums.com/microsoft-access/1692389-error-form.html)

ariansman 04-29-13 00:59

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

ariansman 04-30-13 05:30

why there is no answer to this question? :(

Missinglinq 05-01-13 11:13

"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)>

ariansman 05-01-13 13:46

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

ariansman 05-05-13 02:14

i rebuilt it again and now it is working, i could not find what caused that problem though.


All times are GMT -4. The time now is 10:46.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.