Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access is goofing up my query

Posted on 2013-06-14
3
Medium Priority
?
276 Views
Last Modified: 2013-06-20
Hello - I had to work up a query that formats data from an Access app for upload to a SAP  database.  

Most of the fields are either literal control codes required by SAP, or fields that are set equal to zero-length strings, which I have as Group By's. There are just a few fields of actual data; transaction amounts, summed up to cost identifiers.

After 4 months of working fine, all of a sudden, all the Group By's and Sum's were changed to Expression's. We changed them back like they were, and saved & closed the query.

Then, because I have become very mistrustful of Access, I opened the query back up to make sure it was still as we saved it.

Sure enough, a few of the Group By's had gone back to Expression's, the Sum's were still there, but then there were some new Group By's of just 2 double-quotes together (no "Expr(x)" names like Access puts on expressions by default), with the Show checkboxes un-checked.

Thinking the query was corrupt, I corrected it again, then cut the SQL out, pasted it to NotePad, deleted the query, created a new query, and pasted the SQL back in. I then saved, closed and re-opened it, and it was STILL back to the condition described above.

Any ideas about how this is happening?

Thanks
0
Comment
Question by:mlagrange
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 58

Assisted Solution

by:Jim Dettman (Microsoft MVP/ EE MVE)
Jim Dettman (Microsoft MVP/ EE MVE) earned 1000 total points
ID: 39248910
The query designer will re-arrange items, but the end result should be the same output.

For example, if you do this on a criteria line:

=Forms![myForm]![myControl] or Forms![myForm]![myControl] = Null

under a column, the query editor will reformat the check to this:

=Forms![myForm]![myControl]

and create a new column defined as:

Forms![myForm]![myControl]

with a check of NULL for the criteria.


If it really is goofing up the query logic, then the only option is to always use SQL view for it so it doesn't change it.

Jim.
0
 
LVL 26

Accepted Solution

by:
Nick67 earned 1000 total points
ID: 39249307

After 4 months of working fine, all of a sudden, all the Group By's and Sum's were changed to Expression's. We changed them back like they were, and saved & closed the query.

Nothing is changing the table names, is it?
Because if you are adding or deleting tables (deleting and re-adding them), even if they have the same name, Access may do something about that, ESPECIALLY if name AutoCorrect options are turned on.  It would be quite odd for the query to be altered if nothing is changing in the tables it is based upon, but if THOSE are being subject to change then what is happening has some cause.

If VBA is an option, then you could code up a button to replace the SQL that is in the query with hard-coded text when the button is pressed.  Being able to dynamically alter the SQL behind a saved query using VBA can be a very handy tool.
0
 

Author Closing Comment

by:mlagrange
ID: 39262324
Thanks, guys
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question