Problem with OEM server or ActiveX control

B

burgundy

I am trying, without success, to initialize a form. I made the form as simple
as possible but the problem persists.

I have one form (named “frmInputâ€) with one text box (named “txArtIDâ€).
There are no other objects in the project.

I define one subroutine

Private Sub ClrScreen()
txArtID.Value = "abc" ‘ I plan to change this to txArtID.Value = “†when I
get this error resolved
‘ I also tried txArtID.Text = “†in case I had forgotten which property
required that the text box have ‘ the focus
End Sub

In the form’s “OnOpen†event, I define the event procedure to run the
ClrScreen subroutine in VBA code

Private Sub Form_Open(Cancel As Integer)
ClrScreen
End Sub

When I open the form, I get the following error message

“The expression On Open you entered as the event property setting produced
the following error: A problem occurred while Microsoft Office Access was
communicating with the OLE Server or ActiveX Control.â€

What am I doing wrong? I’ve carefully checked spelling. I tried switching
the order of the two subroutine definitions. I don’t know what else to try.

There are no other objects in the project (I stripped it down to this
minimum to be sure something else wasn’t causing the problem). The only other
code in the project is the “Option Compare Database†line added by Access
above both of the VBA Subs that I added.

I’m using MS Access 2003 and Windows XP. And, as this question shows, I’m a
relative newbie.

Any Help? Please!

Paul Core
 
K

kc-mass

Try this:
Sub ClrScreen()
Forms!frmInput!txArtID.Value = "abc"
End Sub

Regards

Kevin
 
B

burgundy

I get the same error with this. Thanks for the suggestion though.

Any other thoughts?

Paul
 
J

John Spencer

Is the control txtArtID bound to a field (control's source property is
some field)? If so, what is the field type. If the field is a string
what you are doing should work, if it is a number field then try
assigning Null to the txtArtId.Value.

You might also try using the load event instead of the open event and
see if the code works better in the load event.

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
K

kc-mass

Sorry, Ended up with unintended double negative. Should read:
"When I ran it it worked fine in A2003. txArtID was unbound.
 
B

burgundy

As kc-mass reports, it does work in the small example I built to illustrate
the problem. I'm not sure what I changed that made it start working.

The same code still causes the error in the multi-object form I am building.

I'm going to rebuild the form, one object at a time, and check at each step
to be sure it still works. If the problem recurs, I'll know what change
preceeded the problem.

John, all of the objects on the form are unbound.

It will take me a lot of time to rebuild the form (assuming I finish before
the problem arises). I'll report back as soon as I know more.

Thanks a lot to you both for the help.

Paul
 
J

John Spencer

Well, you can probably speed up the process by adding half the controls
and testing. Then add half the remaining (one-fourth) and test. Then
add half the remaining (1/8) and test.

Of course, if you get a failure on the first half, then split that in
half (add the first quarter), etc.

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
B

burgundy

I rebuilt my form with no further problems. It has 52 text boxes, 2 combo
boxes and 33 command buttons and everything seems to work.

I sure wish I knew what I did to cause the problem, so I could avoit doing
it again, but I’m glad it’s gone.

Thanks again for the help and encouragement.

Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top