By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,224 Members | 1,130 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,224 IT Pros & Developers. It's quick & easy.

Debug problem

blyxx86
100+
P: 256
Expand|Select|Wrap|Line Numbers
  1. From help:
  2.  
  3. Using the Print method, this example displays the value of the variable MyVar in the Immediate window. Note that the Print method only applies to objects that can display text.
  4.  
  5. Dim MyVar
  6. MyVar = "Come see me in the Immediate pane."
  7. Debug.Print MyVar
  8.  
  9.  
I want to use this to display how a SQL string will be parsed (so I know that I wrote it correctly within VBA.)

How would I make a msgbox that displays a concatenated SQL string.
Nov 30 '06 #1
Share this Question
Share on Google+
5 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
I want to use this to display how a SQL string will be parsed (so I know that I wrote it correctly within VBA.)

How would I make a msgbox that displays a concatenated SQL string.[/quote]

That code requires that you be in the VB Editor with the 'Immediate Pane' open.

Alternatively you could use an actual msgbox.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim strSQL As String
  3.  
  4.    strSQL = "SELECT ........... etc"
  5.    Msgbox strSQL
  6.  
Nov 30 '06 #2

blyxx86
100+
P: 256
I want to use this to display how a SQL string will be parsed (so I know that I wrote it correctly within VBA.)

How would I make a msgbox that displays a concatenated SQL string.
That code requires that you be in the VB Editor with the 'Immediate Pane' open.

Alternatively you could use an actual msgbox.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim strSQL As String
  3.  
  4.    strSQL = "SELECT ........... etc"
  5.    Msgbox strSQL
  6.  
[/quote]
My apologies for double posting, the other one was just badly explained and I thought it best that I just start over with a new title and a new explanation.

I have a lot of questions obviously about all the different functions, but this one should help me not post so many SQL related questions.
Dec 1 '06 #3

NeoPa
Expert Mod 15k+
P: 31,660
That's fine Blyxx86, and thanks for the explanation.
What you can do if those circumstances arise again, is go to the thread you no longer want, and click on the Report link (giving a brief explanation).
This will enable one of us (moderators) to tidy it up, which we'll be happy to do.

Regards -NeoPa.
Dec 1 '06 #4

blyxx86
100+
P: 256
That's fine Blyxx86, and thanks for the explanation.
What you can do if those circumstances arise again, is go to the thread you no longer want, and click on the Report link (giving a brief explanation).
This will enable one of us (moderators) to tidy it up, which we'll be happy to do.

Regards -NeoPa.
Thank you for the help regarding that, I'll remember from now on.

NeoPa if you could explain the process of using Debug.Print to me that would be wonderful. I'll try using the MsgBox in the meantime, but I believe that using a debug option would be better especially if it lets me do it within VBA and not having to go back to my Access DB to perform the action I've bound to the MsgBox function.
Dec 1 '06 #5

NeoPa
Expert Mod 15k+
P: 31,660
In the VBA code window there are many potential/optional panes (Watch Window; Debug Window; Properties Window; etc).
To show and go to the Debug Window you can use the shortcut Ctrl-G.
If you type ? followed by variables and / or literals they will display on the following line.
This is equivalent to using a Debug.Print line in your code.
Below is a typical use of ? with the results printed below.
Expand|Select|Wrap|Line Numbers
  1. ?strSQL
  2. SELECT * FROM Table
Another way of viewing the contents of a variable in break mode, is to hover the mouse cursor over it for a while.
MsgBox can also be used quite conveniently. You can call it from various places so it doesn't have to be tied in to any other usage you may have for it.
Dec 2 '06 #6

Post your reply

Sign in to post your reply or Sign up for a free account.