Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
VBA Starting a line with Print without the quo
Bruce McCormick 
   
2 years ago
Yeah, got cut off again...

Anyway, i have noticed if i start a line with a question mark it is converted into the word "Print" (WITHOUT THE QUOTATION MARKS)!!!

And to be honest, it was an accident, copying a line from the Immediate window up to the code.

What function and use, if any, does starting a line off with Print provide?

Much thanks!

-Bruce
Alex Hedley  @Reply  
           
2 years ago
Debug.Print ?

? Means you're asking the Immediate Window a Question

?variable
Kevin Robertson  @Reply  
          
2 years ago
? is shorthand for Print.
Kevin Robertson  @Reply  
          
2 years ago

Gary James  @Reply  
      
2 years ago
You use the word "Print", or the shorthand version "?" in the VBA Immediate window to actually display the result of a calculation or the value retuned from a function.  In this example the first call to UCase() returns the result but nothing is displayed.   By adding a "?" to the front of the function the result gets displayed.
Gary James  @Reply  
      
2 years ago

Bruce McCormick OP  @Reply  
   
2 years ago
OK, i obviously wasn't very clear and i apologize for abusing everyone's time with my poor wording in my original post. Far too many times, in speaking also, if i have been focused on an issue, i will presume the world is on the same page as i am. Wish that was my only fault!

Many times i will test the format of a command, Public Functions and Subs or references in the Immediate window to make as sure as i can that i have it right and get a result that i expect (Hope for).

Recently, after doing so, i copied the line i was testing From the Immediate window and INTO my code in the window above the Immediate window. I saw my "?" was converted into the word "PRINT".

My present quest is to find out what value, if any, to me has starting any line of code in the CODE window off with the word PRINT-

I apologize for the confusion i caused!

-Bruce
Kevin Robertson  @Reply  
          
2 years ago
Alex answered that in his comment above. Debug.Print
The editor is merely translating the shorthand (?) to a command that could potentially be used in your code.
Bruce McCormick OP  @Reply  
   
2 years ago
Given that the original question was:

      What function and use, if any, does starting a line off with Print provide?

I'm afraid we still have some confusion, as a question mark in the code window does not translate into DeBug.Print on my computer, such as when i run the following:

Sub QuestionMark()
   Dim sText As String
   sText = "Dog"
   Print sText
End Sub


Where when i created it instead of the word Print there really was a question mark, it simply was translated into the word Print, and this caused an error when run, it was not translated into DeBug.Print

Perhaps that which you are trying to tell me is that it is totally useless at the start of a line in and of itself, and the only actual use is simply as a "shorthand" joined to any term that with a connecting "dot" could be augmented by or augment the word Print?

In an attempt to further clarify, i think i found my answer - The word PRINT as a method must be preceded by and "connected" to an object. The only other use is as a Statement followed by a space and octothorpe and a file number.

Thank You!
Alex Hedley  @Reply  
           
2 years ago
If you're writing it in your code Module you want it as

Sub QuestionMark()
   Dim sText As String
   sText = "Dog"
   Debug.Print sText
End Sub


Print alone would be used in the Immediate Window.
Alex Hedley  @Reply  
           
2 years ago
Can you share a screenshot(s) of what happens?
Kevin Robertson  @Reply  
          
2 years ago
Bruce,

If you type, for example, Debug.? Format(Date(),"dddd, d mmmm yyyy") :

It will be changed to Debug.Print Format(Date, "dddd, d mmmm yyyy") when you leave the line.
Bruce McCormick OP  @Reply  
   
2 years ago
We are missing each other on something i can't come up with the right words to explain! It is the use of the ?, or the keyword PRINT as the first term in a line in the code window, yes, for a module, though that same window could be considered for a "Class Object" which i suppose could also be called the code window for a Form, and likely other objects i don't even know exist, that i was looking to understand use for!

I truly do appreciate both of you guys trying to help me; you must be quite frustrated thinking "What is wrong with this guy???", but we are all good now, i do understand you and i do understand the use :)

Now to go post my new confusion, and pray i don't cause as much as i did in this one-
Gary James  @Reply  
      
2 years ago
Let's start at the beginning.
1.  Is there a reason why you want to have a 'Print' statement in a line of code in a code module?
2.  If so, then you need to use 'Debug.Print' instead of 'Print' in a code module at run time.   'Print' will cause an error in a code module.
Kevin Robertson  @Reply  
          
2 years ago
What Bruce is talking about (I think) is when you copy the code from the Immediate Window (including the question mark) and paste it in the Code Editor, the Editor changes the question mark to the word Print.

Simple solution: don't copy the question mark.
Bruce McCormick OP  @Reply  
   
2 years ago
@Kevin: I love you!!! That was almost everything i was getting at!!!

The corollary was "why would anyone want to start a line of actual working code off with PRINT, and the answer for me is "moo rain at all" ... OK. I soooo enjoy this "swipe" feature. I will attempt the tap method: " No reason at all"! :)

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 4/30/2026 6:52:29 PM. PLT: 0s