Solved Exporting a form as text and then importing.? (1 Viewer)

Gasman

Enthusiastic Amateur
Local time
Today, 07:04
Joined
Sep 21, 2011
Messages
14,361
In trying to help a member in this thread https://www.access-programmers.co.u...-edits-not-working.330848/page-2#post-1916720 I found that the form was likely corrupt as it was behaving strangely.
I suggested that the member recreate the form, but was wondering if they could simply export as text and then import?

However I was unable to do this.
When I exported a file it was called Form_FormName
If I tried to import that, even after changing the filename and the name of the form inside the file, it complained with

1712931314943.png


Seems strange to me that you must 'tweak' something you exported and that will not import as is? :( If it was to a different program I could understand, but when it is Access out and in?

Is this actually possible?, and if so what are the steps to do so please?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:04
Joined
Oct 29, 2018
Messages
21,496
Did you use the SaveAsText method to export the form?
 

cheekybuddha

AWF VIP
Local time
Today, 07:04
Joined
Jul 21, 2014
Messages
2,288
When I exported a file it was called Form_FormName
If I tried to import that, even after changing the filename and the name of the form inside the file, it complained with
Did you delete the existing form before importing from text?
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 02:04
Joined
May 21, 2018
Messages
8,555
You exported from vb window must save and import as text .
 

Gasman

Enthusiastic Amateur
Local time
Today, 07:04
Joined
Sep 21, 2011
Messages
14,361
You exported from vb window must save and import as text .
Exactly where MajP please?
If I remove Form_ from both filename and inside, it will import in VBA window, but as a class module at the bottom, not a form class.
 

cheekybuddha

AWF VIP
Local time
Today, 07:04
Joined
Jul 21, 2014
Messages
2,288
Can we dial back a second @Gasman - how did you do the Save/Load as/from text?

Like:
Code:
Application.SaveAsText acForm, "frmName", "C:\path\to\file.txt"

' and

Application.LoadFromText acForm, "frmName", "C:\path\to\file.txt"

?
 

Gasman

Enthusiastic Amateur
Local time
Today, 07:04
Joined
Sep 21, 2011
Messages
14,361
Can we dial back a second @Gasman - how did you do the Save/Load as/from text?

Like:
Code:
Application.SaveAsText acForm, "frmName", "C:\path\to\file.txt"

' and

Application.LoadFromText acForm, "frmName", "C:\path\to\file.txt"

?
I did not.
I used from the VBA window interactively .....
Export File and accepted the default .cls extension
Then tried an Import File after renaming both filename and the form name inside the file.

So it has to be done via VBA?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 02:04
Joined
Feb 19, 2002
Messages
43,368
Did you use the code I posted in the other thread?

Please post the the code YOU used to export and then to import.
 

Gasman

Enthusiastic Amateur
Local time
Today, 07:04
Joined
Sep 21, 2011
Messages
14,361
Did you use the code I posted in the other thread?

Please post the the code YOU used to export and then to import.
Are you referring to the post I mentioned in post #1 Pat, or some other thread?
 

Gasman

Enthusiastic Amateur
Local time
Today, 07:04
Joined
Sep 21, 2011
Messages
14,361
Can we dial back a second @Gasman - how did you do the Save/Load as/from text?

Like:
Code:
Application.SaveAsText acForm, "frmName", "C:\path\to\file.txt"

' and

Application.LoadFromText acForm, "frmName", "C:\path\to\file.txt"

?
That did the trick. Thank you.

I was going about it the completely wrong way. :(
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:04
Joined
Oct 29, 2018
Messages
21,496
That did the trick. Thank you.

I was going about it the completely wrong way. :(
That's what I was trying to clarify in my first post. Glad to hear you got it sorted out.

It's somewhat weird though. This is the second thread this morning where my posts were missed/ignored. I wonder what I am doing wrong?
 

Gasman

Enthusiastic Amateur
Local time
Today, 07:04
Joined
Sep 21, 2011
Messages
14,361
That's what I was trying to clarify in my first post. Glad to hear you got it sorted out.

It's somewhat weird though. This is the second thread this morning where my posts were missed/ignored. I wonder what I am doing wrong?
Not intended I assure you @theDBguy :)

Just completely missed it.
My apologies.
 

Users who are viewing this thread

Top Bottom