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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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....
Forms!entryForm!accName_txt.Value = "test"
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

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
Scott McDaniel (Microsoft Access MVP - EE MVE )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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.