Results 1 to 4 of 4
  1. #1
    memaxt is offline Novice
    Windows XP Access 2003
    Join Date
    Mar 2013
    Posts
    13

    Application.SaveToText save to table instead

    Hi there,

    I'm looking to save each objects design code using the application.savetotext, but rather than saving to separate text files I would like to save it to a table.

    Ideally like this

    ID | ObjectName | designCode
    1 | form1 | code
    2 | form2 | code

    Etc...

    The design code looks something like this for each object :


    Version =20
    VersionRequired =20


    PublishOption =1
    Checksum =-2018790515
    Begin Form
    PopUp = NotDefault
    RecordSelectors = NotDefault
    NavigationButtons = NotDefault
    DividingLines = NotDefault
    AllowDesignChanges = NotDefault
    DefaultView =0
    ScrollBars =0
    BorderStyle =3
    PictureAlignment =2
    DatasheetGridlinesBehavior =3
    GridY =10
    Width =7005
    DatasheetFontHeight =11
    ItemSuffix =13
    Left =7395
    Top =3165
    Right =14400
    Bottom =6420
    DatasheetGridlinesColor =14806254
    RecSrcDt = Begin
    0x8ce602c412aae440

    Is that possible?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    in access, you dont SaveToText .
    you EXPORT data to text from a table or query.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    ranman, SaveAsText is a valid intrinsic function. It saves the specified object as a text file - a very long text file. This worked for me:

    SaveAsText acForm, "MainMenu", "C:\Temp\Test.txt"

    I don't see any options to save to table. You can import the text file to table. However, each line of the text file would be a record.

    Seems to me simply backing up the Access file should suffice.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 8 Access 2013
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    702
    Quote Originally Posted by ranman256 View Post
    in access, you dont SaveToText .
    you EXPORT data to text from a table or query.
    SaveToText is an undocumented feature that is most often used to by source code control systems.

    I wrote this short article about the feature: Backing up and Restoring Objects

    Quote Originally Posted by memaxt View Post
    Hi there,

    I'm looking to save each objects design code using the application.savetotext, but rather than saving to separate text files I would like to save it to a table.
    @memaxt,

    Curious, Are you working on your own version of Source Code Control?

    There is not a built-in method to automatically store the output of the SaveToText into a table. The good news it that will be very easy to write your own code to do it.


    The Basic language, pre windows days, had built-in command to handle reading and writing to text files. They still exist in VBA today. I have been using them since the mid 1980's.

    The following example from the help should get you started.


    Line Input # Statement Example

    This example uses the Line Input # statement to read a line from a sequential file and assign it to a variable. This example assumes that TESTFILE is a text file with a few lines of sample data.
    Code:
    Dim TextLine
    Open "TESTFILE" For Input As #1   ' Open file.
    Do While Not EOF(1)   ' Loop until end of file.
       Line Input #1, TextLine   ' Read line into variable.
       Debug.Print TextLine   ' Print to the Immediate window.
    Loop
    Close #1   ' Close file.
    When I export a frontend I wire each of the objects in a folder by type. For example all the forms are in a sub folder named forms. I have not had the need to do it for these files, but it would be easy to write code to read the folder and load all the files into a table.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 08-27-2015, 06:05 AM
  2. Replies: 4
    Last Post: 01-05-2014, 02:09 PM
  3. Replies: 1
    Last Post: 04-23-2013, 08:35 AM
  4. Replies: 3
    Last Post: 10-26-2012, 03:19 PM
  5. Replies: 9
    Last Post: 01-20-2011, 02:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums