Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8409175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:49:57+00:00 2026-06-09T23:49:57+00:00

in MS Access i have a field that stores the SQL used for a

  • 0

in MS Access i have a field that stores the SQL used for a project. the sql field is a memo field with “Rich Text” property enabled. what that means is that a code below

CREATE TABLE NR_TMP_1_104 AS
     SELECT DISTINCT tmp.otherid
                    ,tmp.groupno
       FROM NR_tmp_1_900 tmp
           ,NR_TMP_1_103 vp
      WHERE tmp.otherid = vp.otherid;



      SELECT groupno, COUNT(otherid) Counts
      FROM NR_TMP_1_104
      GROUP BY groupno;

     SELECT otherid, actualvpchoice FROM NR_TMP_2_102

really looks like all the way below (i’m sorry for this huge chunk). so that means i can’t do docmd.transfertext, the only way to get normal looking text is to copy and paste.

i need to be able to export this field to a text file and save it with the extension of .sql.

here’s what i have so far))))

Forms!freports!sql.SetFocus
DoCmd.RunCommand acCmdCopy

how do i open a text file, paste what’s on my clipboard and save it as .sql.

thank you very much

"<div>&nbsp;</div>

<div><font size=3 color=blue style=""BACKGROUND-COLOR:#FFFFFF"">CREATE</font><font
size=3 color=black style=""BACKGROUND-COLOR:#FFFFFF""> </font><font size=3
color=blue style=""BACKGROUND-COLOR:#FFFFFF"">TABLE</font><font size=3
color=black style=""BACKGROUND-COLOR:#FFFFFF""> </font><font size=3 color=olive
style=""BACKGROUND-COLOR:#FFFFFF"">NR_TMP_1_104</font><font size=3 color=black
style=""BACKGROUND-COLOR:#FFFFFF""> </font><font size=3 color=blue
style=""BACKGROUND-COLOR:#FFFFFF"">AS</font></div>

<div><font size=3 color=black style=""BACKGROUND-COLOR:#FFFFFF"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font
size=3 color=blue style=""BACKGROUND-COLOR:#FFFFFF"">SELECT</font><font size=3
color=black style=""BACKGROUND-COLOR:#FFFFFF""> </font><font size=3 color=blue
style=""BACKGROUND-COLOR:#FFFFFF"">DISTINCT</font><font size=3 color=black
style=""BACKGROUND-COLOR:#FFFFFF""> tmp</font><font size=3 color=blue
style=""BACKGROUND-COLOR:#FFFFFF"">.</font><font size=3 color=black
style=""BACKGROUND-COLOR:#FFFFFF"">otherid</font></div>

<div><font size=3 color=black style=""BACKGROUND-COLOR:#FFFFFF"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font
size=3 color=blue style=""BACKGROUND-COLOR:#FFFFFF"">,</font><font size=3
color=black style=""BACKGROUND-COLOR:#FFFFFF"">tmp</font><font size=3 color=blue
style=""BACKGROUND-COLOR:#FFFFFF"">.</font><font size=3 color=black
style=""BACKGROUND-COLOR:#FFFFFF"">groupno</font></div>

<div><font size=3 color=black style=""BACKGROUND-COLOR:#FFFFFF"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font
size=3 color=blue style=""BACKGROUND-COLOR:#FFFFFF"">FROM</font><font size=3
color=black style=""BACKGROUND-COLOR:#FFFFFF""> NR_tmp_1_900 tmp</font></div>

<div><font size=3 color=black style=""BACKGROUND-COLOR:#FFFFFF"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font
size=3 color=blue style=""BACKGROUND-COLOR:#FFFFFF"">,</font><font size=3
color=olive style=""BACKGROUND-COLOR:#FFFFFF"">NR_TMP_1_103</font><font size=3
color=black style=""BACKGROUND-COLOR:#FFFFFF""> vp</font></div>

<div><font size=3 color=black style=""BACKGROUND-COLOR:#FFFFFF"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font
size=3 color=blue style=""BACKGROUND-COLOR:#FFFFFF"">WHERE</font><font size=3
color=black style=""BACKGROUND-COLOR:#FFFFFF""> tmp</font><font size=3
color=blue style=""BACKGROUND-COLOR:#FFFFFF"">.</font><font size=3 color=black
style=""BACKGROUND-COLOR:#FFFFFF"">otherid </font><font size=3 color=blue
style=""BACKGROUND-COLOR:#FFFFFF"">=</font><font size=3 color=black
style=""BACKGROUND-COLOR:#FFFFFF""> vp</font><font size=3 color=blue
style=""BACKGROUND-COLOR:#FFFFFF"">.</font><font size=3 color=black
style=""BACKGROUND-COLOR:#FFFFFF"">otherid</font><font size=3 color=blue
style=""BACKGROUND-COLOR:#FFFFFF"">;</font></div>

<div><font size=3 color=black style=""BACKGROUND-COLOR:#FFFFFF"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></div>

<div><font size=3 color=black style=""BACKGROUND-COLOR:#FFFFFF"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></div>

<div><font size=3 color=black style=""BACKGROUND-COLOR:#FFFFFF"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></div>

<div><font size=3 color=black style=""BACKGROUND-COLOR:#FFFFFF"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font
size=3 color=blue style=""BACKGROUND-COLOR:#FFFFFF"">SELECT</font><font size=3
color=black style=""BACKGROUND-COLOR:#FFFFFF""> groupno</font><font size=3
color=blue style=""BACKGROUND-COLOR:#FFFFFF"">,</font><font size=3 color=black
style=""BACKGROUND-COLOR:#FFFFFF""> </font><font size=3 color=blue
style=""BACKGROUND-COLOR:#FFFFFF"">COUNT(</font><font size=3 color=black
style=""BACKGROUND-COLOR:#FFFFFF"">otherid</font><font size=3 color=blue
style=""BACKGROUND-COLOR:#FFFFFF"">)</font><font size=3 color=black
style=""BACKGROUND-COLOR:#FFFFFF""> Counts</font></div>

<div><font size=3 color=black style=""BACKGROUND-COLOR:#FFFFFF"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font
size=3 color=blue style=""BACKGROUND-COLOR:#FFFFFF"">FROM</font><font size=3
color=black style=""BACKGROUND-COLOR:#FFFFFF""> </font><font size=3 color=olive
style=""BACKGROUND-COLOR:#FFFFFF"">NR_TMP_1_104</font></div>

<div><font size=3 color=black style=""BACKGROUND-COLOR:#FFFFFF"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font
size=3 color=blue style=""BACKGROUND-COLOR:#FFFFFF"">GROUP</font><font size=3
color=black style=""BACKGROUND-COLOR:#FFFFFF""> </font><font size=3 color=blue
style=""BACKGROUND-COLOR:#FFFFFF"">BY</font><font size=3 color=black
style=""BACKGROUND-COLOR:#FFFFFF""> groupno</font><font size=3 color=blue
style=""BACKGROUND-COLOR:#FFFFFF"">;</font></div>

<div><font size=3 color=black style=""BACKGROUND-COLOR:#FFFFFF"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font></div>

<div><font size=3 color=black style=""BACKGROUND-COLOR:#FFFFFF"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font
size=3 color=blue style=""BACKGROUND-COLOR:#FFFFFF"">SELECT</font><font size=3
color=black style=""BACKGROUND-COLOR:#FFFFFF""> otherid</font><font size=3
color=blue style=""BACKGROUND-COLOR:#FFFFFF"">,</font><font size=3 color=black
style=""BACKGROUND-COLOR:#FFFFFF""> actualvpchoice </font><font size=3
color=blue style=""BACKGROUND-COLOR:#FFFFFF"">FROM</font><font size=3
color=black style=""BACKGROUND-COLOR:#FFFFFF""> NR_TMP_2_102</font></div>"
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T23:49:58+00:00Added an answer on June 9, 2026 at 11:49 pm

    You can use the PlainText() function to get just the plain text from your memo field’s rich text. Here’s an example from the Immediate window.

    ? DLookup("memo_field", "tblFoo", "id=1")
    <div>a <strong>b </strong>c</div>
    
    ? PlainText(DLookup("memo_field", "tblFoo", "id=1"))
    a b c
    

    Once you get the plain text, you don’t need to go through Notepad in order to write it to a file. You can write to a file directly using VBA file functions or via the Scripting.FileSystemObject methods. Here is an example of the first approach. (I’m assuming Forms!freports!sql contains the rich text.)

    Dim FileNum As Integer
    FileNum = FreeFile()
    Open "C:\SomeFolder\your.sql" For Output As #FileNum
    Write #FileNum, PlainText(Forms!freports!sql)
    Close #FileNum
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a varchar field in a SQL Server database that stores phone numbers
I have a struct that has a field called type How do i access
In my SQL query in Access 2000, I have a field containing numbers like:
In one of the ms-access table I work with we have a text field
I have a text field with a button that filters by a keyword in
I would like to have access to the Seconds_Behind_Master field, (as returned by SHOW
I'd like to have access to one my model field verbose_name. I can get
I have an Access report built on a query, and the [status] field for
Access 2007 is telling me that my new expression is to complex. It used
So I have an awful query that current exists in MS Access that I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.