Viewing Record Source

Steve2106

New member
Local time
Today, 15:22
Joined
Oct 7, 2013
Messages
8
Hi There,

A few people have been helping me in the forum and I am now at a stage where I would like to view the built Record Source.
I would like to put a debug point somewhere and be able to view the Record Source query that has been built so I can see why an error is occuring.
Is there a way I can do that?

I have searched for RecordSource or SELECT tbl_Items.* which is the start of the query in the Record Source, but nothing shows up.

Thanks for the help.

Best Regards,
 
Select the query ,click design button,
The recordsource will show as a table or query.
 
Hi RanMan,
Thanks for the reply.

Yes I am able to do that but when I look at it this way the variables from the code are not filled with values. It has something like:
"Select * from tbl_items where ItemId = " & [pItemId]
I need to temporarily stop the execution with a debug point and check the value of pItemId.

Can I do that?

Thanks again for the help.

Best Regards,
 
If the variables are in a form, you can see the form.
If the variables are in code,and you are assembling an SQL,
Put a break point on the SQL,
When the code stops there, Hoover the cursor over the variable and it will display the value.
You can also type the variable in the immediate window (ctl-G), with Question:
?pItemD
 
If you want to print the record source out, then on the line after you create the recordsource, you could add:

Code:
debug.print me.recordsource
-OR-

Code:
debug.print forms!formname.recordsource
that would show up in the immediate window with the variable translated to the actual value.

Breakpoint would go on line after that so you could see the result. If you want to see the result before it actually becomes a recordsource, then assign the whole thing to a variable:

Code:
stsql="Select * from tbl_items where ItemId = " & [pItemId] 
debug.print stsql
 

Users who are viewing this thread

Back
Top Bottom