Form get User defined type not defined and stops

D

Dennis

Hi,

I've not had a good weekend. This form is driving me crazy.

Initially, when I change the form, it would crash Access. So I followed
Allen Browne's advice in another question in this forum:

1. Uncheck the boxes under Tools | Options | General | Name AutoCorrect
2. Compact the database: Tools | Database Utilities | Compact/Repair
3. Close Access.
Make a backup copy of the file.
Decompile the database
4. Open Access and compact again.
5. Try exporting the form using SaveAsText acForm, "Form1", "C:\form1.txt"
Verify that this created a text file in the specified folder.
Then delete the form, and compact again.
Recreate the form with: LoadFromText acForm, "Form1", "C:\form1.txt"

That worked for a short while, but as I made more changes, it just crashed
the form again.

So I copied the code into a notepad entry and delete the form and compacted
the db again.

I then recreated the form from scratch. So far so good. I got the basic
form working just fine (without the code). I then copied the code from the
notepad into the form's code window. When I ran the form, I received the
error message:

"The expression On Current you entered as the event property setting
produced the following error: User-defined type not defined."

So I deleted all of the code. Then I entered the following code for the
Form's Open event:

Private Sub Form_Current()

' This is a test

End Sub

I then tried running the form again and received the same error message.

I've gone beyond ripping my hair out. I really don't want to start baning
my head against the wall. Does anyone have any suggestions?
 
D

Dirk Goldgar

Dennis said:
Hi,

I've not had a good weekend. This form is driving me crazy.

Initially, when I change the form, it would crash Access. So I followed
Allen Browne's advice in another question in this forum:

1. Uncheck the boxes under Tools | Options | General | Name AutoCorrect
2. Compact the database: Tools | Database Utilities | Compact/Repair
3. Close Access.
Make a backup copy of the file.
Decompile the database
4. Open Access and compact again.
5. Try exporting the form using SaveAsText acForm, "Form1", "C:\form1.txt"
Verify that this created a text file in the specified folder.
Then delete the form, and compact again.
Recreate the form with: LoadFromText acForm, "Form1", "C:\form1.txt"

That worked for a short while, but as I made more changes, it just crashed
the form again.

So I copied the code into a notepad entry and delete the form and
compacted
the db again.

I then recreated the form from scratch. So far so good. I got the basic
form working just fine (without the code). I then copied the code from
the
notepad into the form's code window. When I ran the form, I received the
error message:

"The expression On Current you entered as the event property setting
produced the following error: User-defined type not defined."

So I deleted all of the code. Then I entered the following code for the
Form's Open event:

Private Sub Form_Current()

' This is a test

End Sub

I then tried running the form again and received the same error message.

I've gone beyond ripping my hair out. I really don't want to start baning
my head against the wall. Does anyone have any suggestions?


What version of Access? If it's Access 2003 or earlier, and you'd like me
to take a look at it, put it in a zip file and e-mail it to me. I'll have a
look at it, time permitting. You can send it to the address derived by
removing NO SPAM and ".invalid" from the reply address of this message. If
that address isn't visible to you, you can get my address from my web site,
which is listed in my sig. Do *not* post my real address in the
newsgroup -- I don't want to be buried in spam and viruses.
 
D

Dennis

Dirk,

Thank you for your generous offer. However, I believe that I finally
figured it out. And the worst part is I did it to myself!!!

Once I had the form working, I deleted all of the code. Then I pasted the
code from the original form back in piece by piece. And I tested after each
paste.

I believe the problem has to do with a incorrectly declared function that I
created this weekend (when my problems started). I don't understand why the
incorrectly declared function caused the problem, but when I removed the
function, the form ran just fine.

I will investigate more and publish the result here. Hopefully, my results
might help someone else.
 

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