?
Solved

How to Comment Out Lines of Code in a Pass Through Query In MS Access 2016

Posted on 2017-01-31
19
Medium Priority
?
145 Views
Last Modified: 2017-02-17
I'm working with a MS Access database that was developed by someone else.

I've converted this database to work in the Windows 10 environment with MS Access 2016.  Since converting the database to MS Access 2016, the comments that are in the pass through queries are causing issues.

The comments are commented out as follows:

/*  comments  */

Is there a way to comment out lines in a Pass Through Query in MS Access 2016 (the above way doesn't work in this version of Access)?

Thanks,
gdunn59
0
Comment
Question by:gdunn59
[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
  • 9
  • 4
  • 2
  • +3
19 Comments
 
LVL 46

Expert Comment

by:aikimark
ID: 41987913
What kind of database are you passing-through to?
0
 
LVL 8

Expert Comment

by:Anders Ebro (Microsoft MVP)
ID: 41987916
I wonder if something else is at play. The following works fine for me, using Access 2016 against SQL server 2012
/*This is a comment */
Select top 1 *  from UserRoles.tblUser
/*This is a comment */

Open in new window

Perhaps you haven't updated the connection string? Or installed the right driver?
0
 
LVL 1

Author Comment

by:gdunn59
ID: 41987927
Anders Ebro,

Yes I've updated the connection string, and if I remove the comments it runs fine.

Thanks,
gdunn59
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 46

Expert Comment

by:aikimark
ID: 41987928
have you tried the "--" comment prefix?
0
 
LVL 8

Expert Comment

by:Anders Ebro (Microsoft MVP)
ID: 41987930
What is your backend?
could you try the following SQL and see if it runs:
/*This is a comment */
Select @@SPID
/*This is a comment */

Open in new window

Just as a way of testing whether it might be related to your SQL in combination with the comment, rather than something else
0
 
LVL 1

Author Comment

by:gdunn59
ID: 41987936
Also, it's not SQL Server it's Oracle.

Here's the pass through query:

/* ******************* TODO: CHECK FOR DUPLICATES *********** */

SELECT DISTINCT

   EDMADMIN.CD_WELL.COMPLETION_WELL_ID,
   EDMADMIN.CD_WELL.WELL_ID,
   EDMADMIN.CD_WELL.CONDUCTOR_INSTALL_DATE,
   EDMADMIN.CD_WELL.FIELD_NAME,
   EDMADMIN.CD_DATUM.DATUM_ELEVATION

FROM
   EDMADMIN.CD_WELL,
   EDMADMIN.CD_DATUM

WHERE

   EDMADMIN.CD_WELL.WELL_ID = EDMADMIN.CD_DATUM.WELL_ID(+) AND
   EDMADMIN.CD_WELL.COMPLETION_WELL_ID IN (<WINS_NO>) AND

   UPPER( EDMADMIN.CD_DATUM.IS_DEFAULT) = 'Y' 
  /* UPPER( EDMADMIN.CD_DATUM.DATUM_NAME) = 'RKB' /* removed 4/8/15  */

Open in new window


Thanks,
gdunn59
0
 
LVL 8

Accepted Solution

by:
Anders Ebro (Microsoft MVP) earned 2000 total points
ID: 41987942
It looks like you have an unfinished comment in hte last line:
/* UPPER( EDMADMIN.CD_DATUM.DATUM_NAME) = 'RKB' /* removed 4/8/15  */

Open in new window


Try to replace that with
/* UPPER( EDMADMIN.CD_DATUM.DATUM_NAME) = 'RKB'  removed 4/8/15  */

Open in new window

0
 
LVL 1

Author Comment

by:gdunn59
ID: 41987944
Anders Ebro,

No, what you posted didn't run.  I get the following error (see attached document).

Thanks,
gdunn59
C--Users-msc551-Desktop-Doc1.docx
0
 
LVL 8

Expert Comment

by:Anders Ebro (Microsoft MVP)
ID: 41987946
What I posted worked for SQL server. I must admit I have no experience with Oracle. But in SQL Server a unfinished comment is not allowed, so try to fix that (per my previous post) and see if that helps.
0
 
LVL 1

Author Comment

by:gdunn59
ID: 41987949
Anders Ebro,

I tried your last posting ID: 41987946 and I still get the error that is contained in the document I uploaded in my last posting.

Thoughts??

Thanks,
gdunn59
0
 
LVL 75
ID: 41987950
Thoughts?  Yes ... probably need to post in the Oracle section as well.
0
 
LVL 1

Author Comment

by:gdunn59
ID: 41987984
DatabaseMX (Joe Anderson - Access MVP),

Ok.  Thanks!
0
 
LVL 1

Author Comment

by:gdunn59
ID: 41987991
DatabaseMX (Joe Anderson - Access MVP),

It looks like it was posted to Oracle as well.

Thanks,
gdunn59
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 41988014
>> But in SQL Server a unfinished comment is not allowed,

Also not in Oracle but technically it is finished:  There is only one close.  Oracle should ignore "extra" opens.  It sees a comment start, it continues until it sees a comment end.

Now back to the error:  No idea really.

The error text is real informative:  http://psoug.org/oraerror/ORA-24374.htm

Even though it is an Oracle error message, I'm not sure it is coming from the database.  It might be coming from the Oracle client.

Are you also using upgraded Oracle drivers?  Are those drivers compatible with the version of Oracle database you are connecting to?
0
 
LVL 1

Author Comment

by:gdunn59
ID: 41988081
slightwv,

I'm not sure about the drivers.  I'll have to reach out to the IT guys.

Thanks,
gdunn59
0
 
LVL 38

Expert Comment

by:PatHartman
ID: 41988226
If you copy the SQL and paste it into whatever substitutes for for the new query window in SSMS in Oracle, does the query work?
0
 
LVL 1

Author Comment

by:gdunn59
ID: 41996319
Sorry for the delay.

Pat, I don't have access to SSMS in Oracle.

Thanks,
gdunn59
0
 
LVL 38

Expert Comment

by:PatHartman
ID: 41996369
I know that --
whatever substitutes for for the new query window in SSMS
0
 
LVL 1

Author Comment

by:gdunn59
ID: 41996415
Pat,

Ok.  I'll have to try that when I get a minute.

Thanks,
gdunn59
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

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…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

765 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