Run-time error 7 Out of memory when updating a textbox


I have an access form called "entryForm" with a textbox in the form called "accName_txt"
I've running a vba code below when the form is open and I get the error message

"Run-time error 7 - Out of memory"

I have to be something wrong but I can't picture what
any help would be great
Form_entryForm!accName_txt.Value = "test"

Open in new window

Who is Participating?
Scott McDaniel (Microsoft Access MVP - EE MVE )Connect With a Mentor Infotrakker SoftwareCommented:
You might try a Decompile:

Build a shortcut with this as the Target:

"Full path to msaccess.exe" "full path to your db" /decompile

Make a backup first, of course, then run this, reopen the db, compile again, then Compact and Repair. Even if this works, I'd still build a new, blank database and import everything to it.
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
Generally when I get this error, it's time to close and restart Access IF I've been doing a lot of design work. I also always make a backup at that time. After restarting, you might Compile your code:

From the VBA Editor, click Debug - Compile. Fix any errors.

Then do a Compact and Repair.

Make a backup of your database before doing any of this.

If this code is running on the "entryForm" code, you can just do this:

Me.accName_txt = "test"

Me refers to the active object, which would (presumably) in this case be entryForm.

Possibly a corruption on the database - try compacting and repairing, other reasons may be lack of ram in your machine - how much has it got and what other apps are you running. Also worth checking you have the latest office service packs installed....
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

Forms!entryForm!accName_txt.Value = "test"
ShockUKAuthor Commented:
I've complied the vba script also the database and it still does the same error.

Also tried Forms!entryForm!accName_txt.Value = "test" and I get the error message
Method 'Item' of object 'Forms' failed

Also I'm writing this code into a module so it's not attached to the form,

Thanks for everyons suggests so far
ShockUKAuthor Commented:
I've created a new database and did a quick test and

Sub test()
Forms!entryForm!accName_txt.Value = "test"
End Sub

worked so I guess the database has become corrupted
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.