Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bug - A dialog box appears showing a value

Status
Not open for further replies.

EdAROC

Programmer
Aug 27, 2002
93
US
Using Access to query an ERP (SQL) database. After a variety of queries to pull the data together it ultimately generates a report.

Anyway, what appears to be a dialog box now pops up. It looks like one of my debugging tricks - displaying the value of a variable. In this case the strSQL value which is going to be used in a statement: Set rs = db.OpenRecordset(strSQL)

I've looked in all the coding that I can find - the form, the report, modules and can't find any MsgBox.

Any suggestions?
 
What is the output of Debug.Print strSQL and the exact wording of the dialog box's message ?
You may also post the code that builds strSQL ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
The wording in the dialog box is the value of strSQL. The following code is in a module:

Public Function DrwgAndStyle(JNo As Long, FNo As Integer) As String

Code:
   :
   :
   Dim strSQL As String
   :
   :

   'Select Statement
   strSQL = "SELECT SPECS.DESIGN_NO as EngDrwg, SPECS.STYLE_DESC1 as Style FROM SPECS "
   strSQL = strSQL & "INNER JOIN dbo_ORDERS ON SPECS.SPEC_NO = dbo_ORDERS.SPEC_NO "
   strSQL = strSQL & "WHERE dbo_ORDERS.JOB_NUMBER = " & JNo & " "
   strSQL = strSQL & "And dbo_ORDERS.FORM_NO = " & FNo & " "
   strSQL = strSQL & "ORDER BY SPECS.DESIGN_NO"
   
   Set rs = db.OpenRecordset(strSQL)

My debugging technique would be to place the statement:
MsgBox(strSQL)
just before the Set rs = db.OpenRecordset(strSQL).

When I step through the coding no dialog box appears.
Arggh!
 
Sheesh.

After running the program again (and stepping through the programming one more time), then closing it and re-opening it the problem has disappeared.

Before starting this thread I had:
1. Closed and re-opened the file.
2. Compact Database
3. Searched all the code to find a MsgBox culprit
4. Entered debugging mode at the beginning of the module and stepped through it.
-----
After I submitted the thread I closed and opened the file again and ran it - got the dialog box.
-----
Before submitting the previous thread I got into the file and flagged to stop at the module so I could step through the code one more time.
-----
After I submitted the previous thread I closed the file and reopened it. Ran it and it ran without the dialog box.
-----
I'm still wondering why this happened.
BUT! Given the day and time...
Wishing everyone the best this Christmas weekend.
 
You didn't post the runtime value of strSQL ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top