Error Message when I open a Form

FoxRocks

Registered User.
Local time
Today, 23:09
Joined
Apr 24, 2012
Messages
35
Hello,

I right away feel the need to emphasize just how much of a newbie I am to Access. I say that because I expect the answer to my problem here is going to be so simple that it's going to piss me off when I find out what it is.
So, without further delay...

I'm getting an error message when I open my form. The error message is:

"The expression On Current 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 Active X Control."

Here is my code:

Code:
Private Sub Form_Current()
  Me.PO.Enabled = Me.Parts_On_Order
  Me.Parts_ETA.Enabled = Me.Parts_On_Order
  Me.Parts_Notes.Enabled = Me.Parts_On_Order
  Me.Part_Numbers_Description.Enabled = Me.Parts_Required
  Me.Parts_Required_By.Enabled = Me.Parts_Required
End Sub


Private Sub Parts_On_Order_Click()
If Me!Parts_On_Order.Value = True Then
 Me!PO.Enabled = True
 Me!Parts_ETA.Enabled = True
 Me!Parts_Notes.Enabled = True
Else
 Me!PO.Enabled = False
 Me!Parts_ETA.Enabled = False
 Me!Parts_Notes.Enabled = False
 Me!PO.Value = Null
 Me!Parts_ETA.Value = Null
 Me!Parts_Notes.Value = Null
End If
End Sub

Private Sub Parts_Required_Click()
 If Me!Parts_Required.Value = True Then
  Me!Part_Numbers_Description.Enabled = True
  Me!Parts_Required_By.Enabled = True
 Else
  Me!Part_Numbers_Description.Enabled = False
  Me!Parts_Required_By.Enabled = False
  Me!Part_Numbers_Description.Value = Null
  Me!Parts_Required_By.Value = Null
End If
End Sub
I previously had this (very simple) form running without any issues. The problem occurred after I was trying to add a search box to my form. I actually thought at first I was getting the error because of that search box code, but I've since deleted it all, including the associated text boxes and I'm still getting this error.

Thanks very much for your help :)

~FOX~
 
Which line of the On Current event causes the error.
 
The only difference I can see is Me. rather rather Me!

Simon
 
It doesn't say, I get that error when I first open the form. One other thing I noticed is that my "delete" and "navigation" buttons have stopped working. Is it possible there is something wrong with the macro?
 
try Code window -> Debug -> compile
 
Hi Simon,

Thanks for the help. I just tried that, replacing the bangs with dots and it didn't change anything.
 
Hi Spikepl,

I tried that, but "compile open tasks" is the only option that says anything about compile, but it's greyed out. :(
 
1. Check if no references are marked as missing (code window -> tools -> references)
2. Remove (or comment out) all code from the form and see if that helps to at least open it
3. Recreate form from scratch, and if that works, only add one macro or procedure at a time
 
Hi Spikepl,

Thanks for the help! I tried removing all of the VBA code and that did it. The part the confuses me now is that I created a new form and added in the exact same VBA code (I copied and pasted) and there is no error with that form! I don't get it.
So as I was playing the game of elimination I discovered there is something else acting weird. I've got two "navigation" buttons (left & right), an "add record" button and a "delete record" button. In my database I've got one field that is a required field. The way it was working before everything went sideways was that when I went to a new record, if I didn't enter the required field I would get an error. Perfect, exactly how I want it. So what's happening now is that if I don't enter the required field, there is no error AND I can't navigate off that page, the buttons stop working. What I could do before is hit the "delete record" button than I could navigate to another record, but now everything just quits and without a pop up error message. Now the only way I get the pop up error is if I try to close the form. Weird, right?
 
Alright, I narrowed the VBA code problem to this string:

Code:
Me.PO.Enabled = Me.Parts_On_Order 
Me.Parts_ETA.Enabled = Me.Parts_On_Order
Me.Parts_Notes.Enabled = Me.Parts_On_Order
Whenever it's in the VBA I get that error, without it there is no error. However regardless of this it seems as though my delete button doesn't work now. Something is very weird here, I had this all working just fine, as expected, until I started trying to add a search box to my form. I must have tripped a setting or something, it seems as though the macro side isn't working at all as it should be right now.
Gah! I'll keep playing with it to see if I can figure something out.

Thanks all.
 
It could be the form's corrupted. It's a pain when that happens and happens it does from time to time.

Try creating a new form and copying all properties, objects and code to it.
 

Users who are viewing this thread

Back
Top Bottom