Can't assign Value to this object (1 Viewer)

Gasman

Enthusiastic Amateur
Local time
Today, 22:47
Joined
Sep 21, 2011
Messages
14,238
I never called it Form_frmMain ever. Access did that. How do I get (import) the Form back into Access? Whether it's called "Form_frmMain" or just "frmMain" still gives the same error message. It's a really big Form and I don't want to rebuild it

Not something I have ever done, but it appears you exported the form from the VBA window and not the Navigation panel.? That automatically gives it the name it is in the VBA window and saves it as a class?
 

kirkm

Registered User.
Local time
Tomorrow, 09:47
Joined
Oct 30, 2008
Messages
1,257
Thanks Dave, that is something to try and certainly will do, but first I have to figure out how to restore my main Form. As Gasman said that's exactly what I did. It appeared to be the correct method (else why would Access have this export option if it would never import it again?). To Colin, that won't work as there isn't a database to get it from - only the .cls file created with this so-called "Export".
 

isladogs

MVP / VIP
Local time
Today, 22:47
Joined
Jan 14, 2017
Messages
18,209
Exporting as files from the VBE is used for transferring code only.
I do occasionally export standard or class modules from the VBE as text files (.bas or .cls respectively).
This allows me to email just module code to other users without an attached database.

Doing that with your form code means you have transferred that as a class module but without the form itself.
Do you still have the original form frmMain in Comp2 or another backup that you said is potentially good?
If so, you can still transfer that by the method I suggested.

If not, you will unfortunately need to make a new form with all the controls.
Set the Has Module property to Yes. You can then copy and paste all the code from your .cls text file to your form module.

Hope that helps.
 
Last edited:

Gasman

Enthusiastic Amateur
Local time
Today, 22:47
Joined
Sep 21, 2011
Messages
14,238
Not going to help now, but I would have copied and named the copy as old- in the Navigation Window, then exported/amended whatever.

If something went wrong as in this case, then I would repeat from the copy and try again after finding out what I did wrong.

Can you not get the form object from a backup and then use the code from that export.?

I do agree that it is a little silly to suggest a name that does not allow import with the same name, as if you remove the Form_ prefix it will bring it in as a simple class file.?

Thanks Dave, that is something to try and certainly will do, but first I have to figure out how to restore my main Form. As Gasman said that's exactly what I did. It appeared to be the correct method (else why would Access have this export option if it would never import it again?). To Colin, that won't work as there isn't a database to get it from - only the .cls file created with this so-called "Export".
 

kirkm

Registered User.
Local time
Tomorrow, 09:47
Joined
Oct 30, 2008
Messages
1,257
Thanks Colin and Gasman, now I know and what not to do again. I think it works in Excel and probably just assumed....
I do have a backup but there will be some last changes I'll prob lose. It did import class modules (6 of them). May take me while to restore everything, then I'm keen to try Gemma's suggestion. I devised a workaround that would edit the field, by not opening frmMain - just the Edit Form, but it's not optimum. And finding exactly what/why this happened is my goal.
 

Gasman

Enthusiastic Amateur
Local time
Today, 22:47
Joined
Sep 21, 2011
Messages
14,238
I believe if you can get the form itself back and the controls have not changed, then all you need is the latest code and you can get all your amended code from the file you exported.?
 

kirkm

Registered User.
Local time
Tomorrow, 09:47
Joined
Oct 30, 2008
Messages
1,257
Dave, re record selectors - I added them to frmMain and the Edit Form. In frmMain it shows beside the Navigation Pane with one triangle/arrow. I couldn't see anything in the edit form.


The Edit Form is a collection of controls and buttons. The MainForm has 2 sections, one with buttons and one with a table (subform).



While editing a record I can see the mainform and the triangle/arrow did not change. This was the same for both a record that would allow an edit, and one that won't (and tells me its locked by another session).
I can't really upload it as it's way too big and full of rubbish as I've tried different or temporary bits of code.

There is no way to stop the code at a point where another 'session' starts ?


There's now a 2nd copy (on another computer) and it works, but theres a lot of stuff missing and I can't just swap over to it. If I could identify what Form has the problem maybe progressively add things in until the error shows ? Or, is there a better plan?
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 22:47
Joined
Sep 12, 2006
Messages
15,641
I can see your last post was a couple of days ago. I just don't understand how your record is getting locked without the indicator changing. Can you put record selectors on the subform? Is this a "split" from by any chance? I don't use split forms, but they might give you weird results.

I'm just clutching at straws really.

Are the datatables in a separate database. The data tables couldn't be open in another app, could they? Another access database, or even Excel?
 

kirkm

Registered User.
Local time
Tomorrow, 09:47
Joined
Oct 30, 2008
Messages
1,257
Dave, I kindof put it to one side. After spending 2 weeks getting nowhere I've lost heart! The new Edit form does the job if I close the main Form (and as it hiccups only on really long fields = over 2000 chars) it's a rough enough workaround. After removing "dirty = false" I've only had one locked ldb needing a reboot and that was when trying things out to see results.(Nothing significant was found). Not sure about "Split Form" there is a datasheet subform on the main Form, otherwise everything is contained in the one mdb (no backend or Excel etc).
There is a working copy on a 2nd computer but it's a severely cut-down version. If I get re-motivated maybe comparing every procedure in each might show something.
Many thanks to you and everyone who helped and offered suggestions.
 

Users who are viewing this thread

Top Bottom