debug question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Another quick question: in debugging code, F8 takes your forward. Is there a
way to back up one step?
 
It would go completely against all the rules of debugging to go backwards,
interesting idea, very complicated because what are you stepping backward,
code, variables, tables, user actions, sounds to me like you need monitor
more information as you are debugging so that you understand what is
happening on each step.
 
Select the highlighted line with your mouse, and then drag it back to the
line you want to do over.
 
Hi Paul,

My lesson for the day,

I'm surprised, it works, but surely it is not going to roll back database
action and will only work within a specific module.
 
Many thanks, guys. I just wanted see to again what the code just did so this
will do it. I don't care about the data because I'm programming against a
development DB, never the production DB.
You guys are great.
 
It depends on the operation being repeated and what has transpired between
the first time the line was executed, for example...

strSQL = "UPDATE sometable SET SomeField='Whatever'"

db.Execute strSQL

strSQL = "DELETE * FROM sometable"

db.Execute strSQL

If you returned to the 2nd line after the 3rd line has executed, you'd be
deleting instead of updating....probably not what you want. Obviously, this
is a very simple example, but you could encounter a variety of issues if the
procedure were more complex. Having the ability to repeat an operation
while debugging is sometimes useful though....you just need to be mindful of
what has been done or might result.
 
Another point,

I wrote this small procedure to test what happens with variables and it show
one of the problems with the idea of debugging backward, break on the line

inTest = 1

hit F8 a few times take the value of intTest then drag the cursor back, the
variable holds the value, not resetting it back to what is should be at that
point, so be careful with what you are debugging,

Public Sub test()
Dim intTest As Integer
intTest = 1
intTest = intTest + 1
intTest = intTest + 1
intTest = intTest + 1
intTest = intTest + 1
intTest = intTest + 1
intTest = intTest + 1
intTest = intTest + 1
intTest = intTest + 1
End Sub

--
Regards

Alex White MCDBA MCSE
http://www.intralan.co.uk

smk23 said:
Many thanks, guys. I just wanted see to again what the code just did so
this
will do it. I don't care about the data because I'm programming against a
development DB, never the production DB.
You guys are great.
 
Back
Top