Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: Access 2000 won't break on a breakpoint


Message #1 by "Tim Norton" <tttbsn@h...> on Tue, 22 May 2001 17:40:52
Hello,



I've been using Access for many years now and I've never seen this one.  

I was contracted to work on an Access 2000 database that has a brother 

image in Access 97.  The Access 97 platform works fine with the same 

codeing.  However on the Access 2000 platform I am having problems with 

some of the coding. I have a command button on a form that runs upwards of 

12 functions.  I need to see a detailed run of the coding and have 

inserted multiple breakpionts on the code.  When the commande button is 

activated and the funcitons are run, they will not stop at any of the 

breakpoints, it will continue to run through all of the functions with out 

stopping/stepping into any of the code.  I have gone as far as to put a 

break piont on every line of code through all of the associated functions 

with no luck.  

I have never seen a breakpiont/step-into not work.



Does anybody have any ideas?

Below is a listing of the first function performed.



*****************************************************************

Private Sub cmdExport_Click()

On Error GoTo Err_cmdExport_Click



    Dim stDocName As String

    Dim strWhere As String

    Dim nPos As Integer

    Dim stReplace As String

    Dim objEnergymap As Object

    Dim sSheetName As String

    'These are for the Temp directory Registry Check

    Dim nRet As Long

    Dim sTempPath As String

    Dim sSystemTemp As String * 512

    'These are for the Registry Check for Powermap

    Dim hKey As Long

    Dim vValue As Variant

    Dim lrc As Long

    Dim lReserve As Long

    Dim lType As Long

    Dim sKeyName As String

    Dim sValueName As String

    Dim sValue As String

    Dim cch As Long

    Dim sFile As String

    Dim sFileTitle As String

    'This places the path of their POWERmap Programs directory in vValue

    'sKeyName = "Software\Resource Data International, Inc.\POWERmap\2.0

\File Locations"

    'sValueName = "Programs Directory"

    'lrc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, sKeyName, 0&, KEY_QUERY_VALUE, 

hKey)

    'lrc = RegQueryValueExNULL(hKey, sValueName, 0&, lType, 0&, cch)

    'sValue = String(cch, 0)

    'lrc = RegQueryValueExString(hKey, sValueName, 0&, lType, sValue, cch)

    'vValue = Left$(sValue, cch - 1)

    'RegCloseKey (hKey)

    

    'This gets the Path of their Temp Directory

    nRet = GetTempPath(512, sSystemTemp)

    sTempPath = Left(sSystemTemp, nRet)

    

    'Gets NEWGen path

    sKeyName = "Software\Resource Data International, Inc.\NEWgen\File 

Locations"

    sValueName = "Data Directory"

    lrc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, sKeyName, 0&, KEY_QUERY_VALUE, 

hKey)

    lrc = RegQueryValueExNULL(hKey, sValueName, 0&, lType, 0&, cch)

    sValue = String(cch, 0)

    'Checks for registry Entry

    If sValue = "" Then

        MsgBox "Please install NEWGen again", , "Registry Error"

        Exit Sub

    End If

    lrc = RegQueryValueExString(hKey, sValueName, 0&, lType, sValue, cch)

    sValue = Left$(sValue, cch - 1)

    sValue = sValue & "\"

    RegCloseKey (hKey)

    

    'Launches the Query

    strWhere = BuildQueryString("HoldingCompany")

    stDocName = "Query Module Project List Export POWERmap"

    sSheetName = "Query Module Project List Expor"

    DoCmd.OpenQuery stDocName, acNormal, acEdit

    

    On Error Resume Next

    'Tries to open Energymap

'    Set objEnergymap = CreateObject("Energymap.Application")

'    If Err.Number <> 0 Then

        'Opens a Save As dialog box

        With dlgSaveAs

            .DialogTitle = "Save POWERmap Export File As"

            .Flags = cdlOFNOverwritePrompt

            .Flags = cdlOFNHideReadOnly

            .Flags = cdlOFNPathMustExist

            .CancelError = True

            .FileName = "NEWGen-POWERmap Export.xls"

            .Filter = "Microsoft Excel Workbook (*.xls)|*.xls"

            .InitDir = sValue

            .ShowSave

            If Len(.FileName) = 0 Then

                Exit Sub

            End If

            sFile = .FileName

        End With

'Checks to see if the Cancel button was pressed

        If Err <> 32755 Then

            MsgBox ("An Excel file has been created in " & sFile & Chr(13) 

& Chr(13) & "This may be imported into POWERmap using the Map from Excel 

tool in POWERmap.")

            DoCmd.OutputTo acOutputQuery, stDocName, acFormatXLS, sFile, 0

        End If

'    Else

'        DoCmd.OutputTo acOutputQuery, stDocName, acFormatXLS, sTempPath 

& "pmap.xls", 0

'        objEnergymap = objEnergymap.passdata(sTempPath & "pmap.xls", 

sSheetName)

'    End If

    

    'If strWhere <> "" Then

        'DoCmd.ApplyFilter , strWhere

    'End If

Exit_cmdPowerMapExport_Click:

    Exit Sub



Err_cmdPowerMapExport_Click:

    MsgBox Err.Description

    Resume Exit_cmdPowerMapExport_Click





End Sub
Message #2 by "Pardee, Roy E" <roy.e.pardee@l...> on Tue, 22 May 2001 10:47:01 -0700
Never seen that, except in .mde's but I'm guessing that's not an issue here.

If you add the line 



debug.assert false



will it break then?  How about issuing a stop command?



Have you searched the KB?



HTH,



-Roy



-----Original Message-----

From: Tim Norton [mailto:tttbsn@h...]

Sent: Tuesday, May 22, 2001 10:40 AM

To: Access

Subject: [access] Access 2000 won't break on a breakpoint





Hello,



I've been using Access for many years now and I've never seen this one.  

I was contracted to work on an Access 2000 database that has a brother 

image in Access 97.  The Access 97 platform works fine with the same 

codeing.  However on the Access 2000 platform I am having problems with 

some of the coding. I have a command button on a form that runs upwards of 

12 functions.  I need to see a detailed run of the coding and have 

inserted multiple breakpionts on the code.  When the commande button is 

activated and the funcitons are run, they will not stop at any of the 

breakpoints, it will continue to run through all of the functions with out 

stopping/stepping into any of the code.  I have gone as far as to put a 

break piont on every line of code through all of the associated functions 

with no luck.  

I have never seen a breakpiont/step-into not work.



Does anybody have any ideas?

Below is a listing of the first function performed.



*****************************************************************

Private Sub cmdExport_Click()

On Error GoTo Err_cmdExport_Click



    Dim stDocName As String

    Dim strWhere As String

    Dim nPos As Integer

    Dim stReplace As String

    Dim objEnergymap As Object

    Dim sSheetName As String

    'These are for the Temp directory Registry Check

    Dim nRet As Long

    Dim sTempPath As String

    Dim sSystemTemp As String * 512

    'These are for the Registry Check for Powermap

    Dim hKey As Long

    Dim vValue As Variant

    Dim lrc As Long

    Dim lReserve As Long

    Dim lType As Long

    Dim sKeyName As String

    Dim sValueName As String

    Dim sValue As String

    Dim cch As Long

    Dim sFile As String

    Dim sFileTitle As String

    'This places the path of their POWERmap Programs directory in vValue

    'sKeyName = "Software\Resource Data International, Inc.\POWERmap\2.0

\File Locations"

    'sValueName = "Programs Directory"

    'lrc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, sKeyName, 0&, KEY_QUERY_VALUE, 

hKey)

    'lrc = RegQueryValueExNULL(hKey, sValueName, 0&, lType, 0&, cch)

    'sValue = String(cch, 0)

    'lrc = RegQueryValueExString(hKey, sValueName, 0&, lType, sValue, cch)

    'vValue = Left$(sValue, cch - 1)

    'RegCloseKey (hKey)

    

    'This gets the Path of their Temp Directory

    nRet = GetTempPath(512, sSystemTemp)

    sTempPath = Left(sSystemTemp, nRet)

    

    'Gets NEWGen path

    sKeyName = "Software\Resource Data International, Inc.\NEWgen\File 

Locations"

    sValueName = "Data Directory"

    lrc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, sKeyName, 0&, KEY_QUERY_VALUE, 

hKey)

    lrc = RegQueryValueExNULL(hKey, sValueName, 0&, lType, 0&, cch)

    sValue = String(cch, 0)

    'Checks for registry Entry

    If sValue = "" Then

        MsgBox "Please install NEWGen again", , "Registry Error"

        Exit Sub

    End If

    lrc = RegQueryValueExString(hKey, sValueName, 0&, lType, sValue, cch)

    sValue = Left$(sValue, cch - 1)

    sValue = sValue & "\"

    RegCloseKey (hKey)

    

    'Launches the Query

    strWhere = BuildQueryString("HoldingCompany")

    stDocName = "Query Module Project List Export POWERmap"

    sSheetName = "Query Module Project List Expor"

    DoCmd.OpenQuery stDocName, acNormal, acEdit

    

    On Error Resume Next

    'Tries to open Energymap

'    Set objEnergymap = CreateObject("Energymap.Application")

'    If Err.Number <> 0 Then

        'Opens a Save As dialog box

        With dlgSaveAs

            .DialogTitle = "Save POWERmap Export File As"

            .Flags = cdlOFNOverwritePrompt

            .Flags = cdlOFNHideReadOnly

            .Flags = cdlOFNPathMustExist

            .CancelError = True

            .FileName = "NEWGen-POWERmap Export.xls"

            .Filter = "Microsoft Excel Workbook (*.xls)|*.xls"

            .InitDir = sValue

            .ShowSave

            If Len(.FileName) = 0 Then

                Exit Sub

            End If

            sFile = .FileName

        End With

'Checks to see if the Cancel button was pressed

        If Err <> 32755 Then

            MsgBox ("An Excel file has been created in " & sFile & Chr(13) 

& Chr(13) & "This may be imported into POWERmap using the Map from Excel 

tool in POWERmap.")

            DoCmd.OutputTo acOutputQuery, stDocName, acFormatXLS, sFile, 0

        End If

'    Else

'        DoCmd.OutputTo acOutputQuery, stDocName, acFormatXLS, sTempPath 

& "pmap.xls", 0

'        objEnergymap = objEnergymap.passdata(sTempPath & "pmap.xls", 

sSheetName)

'    End If

    

    'If strWhere <> "" Then

        'DoCmd.ApplyFilter , strWhere

    'End If

Exit_cmdPowerMapExport_Click:

    Exit Sub



Err_cmdPowerMapExport_Click:

    MsgBox Err.Description

    Resume Exit_cmdPowerMapExport_Click





End Sub




Message #3 by "Tim Norton" <tttbsn@h...> on Tue, 22 May 2001 22:19:22
Roy,



Thanks for the email.



Nope, it's not an .mde, you guessed right.

I tried all of the debug commands and they worked in the immediate window 

(displayed results) but wouldn't break the code.  Even Stop wouldn't 

work.  



But......  I did just find out the problem.  On open there is a public 

function that alters, adds and edits the windows registry files.  There 

was a small little blurp that ran that was turning off the debugging 

commands through the registry.  Not until I went through the 12 1/2 pages 

of code did I find it.  Basically it replaced some of the windows, office, 

access, registry files.

And stupid me didn't hold down the shift key on open to bypass all of the 

startup functions.  Hell I din't think I needed to, there was no form 

opening on startup, just the database window.  And who would intentionally 

turn off the debugging tools?  If I find them, I'll have to remember to 

slap them...



Problem fixed, but it kicked my butt for almost 2 days...  And now I feel 

stupid.



Thanks again for the reply,



Take care,



Tim



> Never seen that, except in .mde's but I'm guessing that's not an issue 

here.

> If you add the line 

> 

> debug.assert false

> 

> will it break then?  How about issuing a stop command?

> 

> Have you searched the KB?

> 

> HTH,

> 

> -Roy

> 
Message #4 by "Pardee, Roy E" <roy.e.pardee@l...> on Wed, 23 May 2001 08:57:04 -0700
Zounds, that is a pretty goofy thing to do--and a long way to go to do it!

I wouldn't know how to turn those things off in the registry if I wanted to.

You should not feel stupid.



I *guess* that sort of thing might be useful if your users are using the

access "runtime" version (which I believe reacts to runtime errors by

unceremoniously bailing).  But that's a poor substitute for actual error

handling...



Cheers,



-Roy



-----Original Message-----

From: Tim Norton [mailto:tttbsn@h...]

Sent: Tuesday, May 22, 2001 3:18 PM

To: Access

Subject: [access] RE: Access 2000 won't break on a breakpoint





Roy,



Thanks for the email.



Nope, it's not an .mde, you guessed right.

I tried all of the debug commands and they worked in the immediate window 

(displayed results) but wouldn't break the code.  Even Stop wouldn't 

work.  



But......  I did just find out the problem.  On open there is a public 

function that alters, adds and edits the windows registry files.  There 

was a small little blurp that ran that was turning off the debugging 

commands through the registry.  Not until I went through the 12 1/2 pages 

of code did I find it.  Basically it replaced some of the windows, office, 

access, registry files.

And stupid me didn't hold down the shift key on open to bypass all of the 

startup functions.  Hell I din't think I needed to, there was no form 

opening on startup, just the database window.  And who would intentionally 

turn off the debugging tools?  If I find them, I'll have to remember to 

slap them...



Problem fixed, but it kicked my butt for almost 2 days...  And now I feel 

stupid.



Thanks again for the reply,



Take care,



Tim



> Never seen that, except in .mde's but I'm guessing that's not an issue 

here.

> If you add the line 

> 

> debug.assert false

> 

> will it break then?  How about issuing a stop command?

> 

> Have you searched the KB?

> 

> HTH,

> 

> -Roy

> 





  Return to Index