469,898 Members | 2,248 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

Saving design changes

For a client who wants answers, but doesn't want to bother to learn Access,
I've built a cut-down query generator, where they can select fields and
criteria. I then compose the appropriate SQL SELECT statement and assign it
to a fixed query name. ( qryTemp.SQL= MySQLString)
qryTemp is the SourceObject for a subform on a form which I then open.
(Note that the query itself is the source object, not a form based
on it.)
So far, this works great!

My problem is that whenever I go to close this form (or even when it loses
focus), I get a messagebox asking if I want to save changes to the query.
If I choose "No", I get another one. (only 2, though)
I've thought that I could take care of this by saving the form before I
close it, but my attempts have all been rewarded with an error on the order
of "you can't do this now".

I don't think my tech-phobic clients will be pleased by this message.
Any ideas how I can avoid it?

- Turtle
BTW I'm working in A2K2, with A2K file format.
Nov 13 '05 #1
7 2016
MacDermott wrote:

You could try to close the query from the LostFocus event of the form,
including the acSaveNo argument with Docmd.Close.

Catch the "you cannot do that now" with an On Error Resume Next.
--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #2
Close the query?
Like
DoCmd.Close acQuery, "tmpQuery", acSaveNo
I'll sure give it a try, but AFAIK, the query is open only as part of the
form.
Wouldn't that be a bit like trying to close a subform?

- Turtle

"Bas Cost Budde" <b.*********@heuvelqop.nl> wrote in message
news:cn**********@news2.solcon.nl...
MacDermott wrote:

You could try to close the query from the LostFocus event of the form,
including the acSaveNo argument with Docmd.Close.

Catch the "you cannot do that now" with an On Error Resume Next.
--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea

Nov 13 '05 #3
MacDermott wrote:
Close the query?
Like
DoCmd.Close acQuery, "tmpQuery", acSaveNo
I'll sure give it a try, but AFAIK, the query is open only as part of the
form.
Wouldn't that be a bit like trying to close a subform?


If you did a docmd.openquery, no, definately not: the query is an
independent object. If you have it otherwise, let me know, I have a
place to apply that.

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #4
Why not just save the SQL as text in a table? Unless their PCs are really
slow, the overhead for compiling the query is negligible. Then call the
query in code.
Darryl Kerkeslager

"MacDermott" <ma********@nospam.com> wrote:
My problem is that whenever I go to close this form (or even when it loses
focus), I get a messagebox asking if I want to save changes to the query.
If I choose "No", I get another one. (only 2, though)
I've thought that I could take care of this by saving the form before I close it, but my attempts have all been rewarded with an error on the order of "you can't do this now".

I don't think my tech-phobic clients will be pleased by this message.
Any ideas how I can avoid it?

Nov 13 '05 #5
I'm not using DoCmd.OpenQuery to display the recordset.

The query is embedded as a subform in a form, so that I can have a header
section with a variety of buttons and descriptive text. (This is not a full
subform in datasheet view; the SourceObject for the subform control reads
Query:qryTemp.)

I open this form using DoCmd.OpenForm.

More ideas?
- Turtle

"Bas Cost Budde" <b.*********@heuvelqop.nl> wrote in message
news:cn**********@news2.solcon.nl...
MacDermott wrote:
Close the query?
Like
DoCmd.Close acQuery, "tmpQuery", acSaveNo
I'll sure give it a try, but AFAIK, the query is open only as part of the form.
Wouldn't that be a bit like trying to close a subform?


If you did a docmd.openquery, no, definately not: the query is an
independent object. If you have it otherwise, let me know, I have a
place to apply that.

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea

Nov 13 '05 #6
Thanks for your thoughts.

I take care of saving the SQL elsewhere.
The issue is that I don't want to just call the query in code;
I want to embed it in a form.

- Turtle
"Darryl Kerkeslager" <Ke*********@comcast.net> wrote in message
news:ro********************@comcast.com...
Why not just save the SQL as text in a table? Unless their PCs are really
slow, the overhead for compiling the query is negligible. Then call the
query in code.
Darryl Kerkeslager

"MacDermott" <ma********@nospam.com> wrote:
My problem is that whenever I go to close this form (or even when it loses focus), I get a messagebox asking if I want to save changes to the query. If I choose "No", I get another one. (only 2, though)
I've thought that I could take care of this by saving the form
before I
close it, but my attempts have all been rewarded with an error on the

order
of "you can't do this now".

I don't think my tech-phobic clients will be pleased by this message.
Any ideas how I can avoid it?


Nov 13 '05 #7
MacDermott wrote:
I'm not using DoCmd.OpenQuery to display the recordset.

The query is embedded as a subform in a form, so that I can have a header
section with a variety of buttons and descriptive text. (This is not a full
subform in datasheet view; the SourceObject for the subform control reads
Query:qryTemp.)

I open this form using DoCmd.OpenForm.

More ideas?


Yup, not yet out of ammo.

Now that I read your question carefully :-) I understand my previous
advice is a blunder. So you have this query as an open object. Do you
assign the SQL before the object opens? I think you say so. What if you
*do* save changes on form.close? so appending acSaveYes. Or maybe acSaveNo.

If it won't solve the popping up of the message, try runcommand.save
before you close.

--
Bas Cost Budde, Holland
http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Nov 13 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by wayne dooley | last post: by
2 posts views Thread by manning_news | last post: by
11 posts views Thread by kaosyeti | last post: by
3 posts views Thread by Steve Long | last post: by
27 posts views Thread by RobG | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.