Click here to Skip to main content
15,899,754 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I´m working with an Access 2010 application, and I´m getting a really strange behavior with the environment (well, at least for me, i never worked with it before). But this time I´ll ask only the following, because I just can't find the reason:

I set a few breakpoints in some lines in the vba code, in order to follow the flow of execution. Few of them works perfectly, the execution stops and I can follow step by step the subsecuent lines; but there are others that just do not stop, even they are well stablished.

Those that I set in the modules executed by the autoexec macro are the ones working fine, and not the others.

The only thing i can see is that a customized ribbon is loaded when a forms appears after the autoexec macro execution.

Can anybody helpme ?

What I have tried:

Search thru google for a big time, but i haven´t found anything. I´m about to get crazy.
Posted
Updated 28-Sep-17 9:45am
Comments
Miguel Altamirano Morales 29-Sep-17 11:54am    
I´m seing that VBA Access doesn´t keep the set breakpoints when I save the DataBase, just like Visual Basic 6.0 (or NET) used to do.

I wonder if execution of an entire system does not continue when the autoexec macro finishes running (manually). Maybe that´s the reason why my breakpoint doesn´t work. The module where it is, is not in the range of the autoexec macro,so the flow never gets to that point. (I´m loading the source database holding the shift key, that's the only way I've seen that lets me set breakpoints and analyze the code)

I added a "Stop" command to the code, trying to simulate a breakpoint but still doesn't work. I send you a copy of the code. The previous Msgbox after the Stop runs well, so I don´t know why the stop fails.

When you load the database holding the shift key, is there a way to run the entire system ? (I mean without having to execute the autoexec macro manually)

Sub OnActionTglButton(control As IRibbonControl, pressed As Boolean)

' Callbackname in XML File "onAction"

' Callback for a Toggle Buttons click event

MsgBox "Quitar éste mensaje", vbCritical, "basRibbonCallbacks"

Stop

Select Case control.Id

Case "tgbclientes"
' In Tab: tabclientes
' In Group: grpclientes
parms(6) = min_pedido()
If parametro(125) = 1 Then
DoCmd.RunSQL ("UPDATE dbo_restricciones SET formulario='f_clientes' " & _
"WHERE programa_id=9")
Else
DoCmd.RunSQL ("UPDATE dbo_restricciones SET formulario='f_clientes_america' " & _
"WHERE programa_id=9")
End If

......... continues

1 solution

You show no code so ...
Read this page: Debugging VBA[^]

Advice: make sure the parts of code with breakpoint that don't stop are really executed.
I would put more breakpoints around and also some checkpoints by storing specific values that tell which sequences of code have been executed.

[Update]
Don't forget to comment error handlers.
Every times I have got this problem, code was not executed for some reason: and error handler, a failing test ...
 
Share this answer
 
v3
Comments
Miguel Altamirano Morales 28-Sep-17 17:12pm    
Thank you very much, my friend, I´ll do what you suggest me and, if you agree, I´ll let you know what happened.
Patrice T 28-Sep-17 18:47pm    
no problem.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900