Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't easily get saved query to actually save in an existing form.

Status
Not open for further replies.

WantToKnowMore

Programmer
Apr 6, 2004
31
US
I copied an existing form containing two subforms all have embedded queries; then I went into the new forms and wanted to change the embedded query from the current table to a historical table. I usually go to the sql view and cut/paste into Word and make my table name changes and paste back. I've done this numerous times with Access 2003 with no problems.

However, in 2007, I had a lot of trouble getting the query changes I made to simply save with the form. Is there a bug or a trick to saving a query change in a form? I even made cosmetic changes to the form to force it to save. The form would always appear to save and it did - everything but the query change.

I finally got it to save, but after about 10 different ways to save, it finally took. Maybe its best to have an external query in 2007 rather than an embedded one in the forms.

Any advice would be appreciated!
 
The usual way of changing the query associated with a form is to change the Record Source property of the form in design view. Any other way is suspect at best.
 
Thanks - but that is where I am making my change to the SQL statement. I can see the change and when I save the SQL statement to save within the form, the change to the query doesn't take.
 
I am not sure I understand you, so I will make a few comments. Changing the SQL statement in a form will not change a query. If you wish to change the query, use the query design screen. You can access this from the form in design view or from the database window. The records source of a form can be a table, a query or an SQL statement. Each need to be edited in its own way.
 
How are ya WantToKnowMore . . .

For starters, don't cut/paste into Word which adds a number of control characters for formatting and such. Instead always cut/paste into an ascii text editor like NotePad!

Now . . . after you've pasted the new SQL and closed query design view, you'll be back in form view with focus on the [blue]RecordSource[/blue] property. To register the change just [blue]set focus any other property[/blue], then his the save toolbar button. This should do it! . . .

[blue]Your Thoughts? . . .[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Thanks TheAceMan1 - for both tips. I can see by clicking in another property the SQL statement was updated. Such a small thing can drive one crazy. In addition, I will use NotePad to cut and paste. Again, much thanks.
 
WantToKnowMore . . .

Be sure to have a look at one of the links at the bottom of any of my posts! . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top