Hi. Earlier, you said when you clicked on the Save button, you see the MsgBox we added. Are you saying when you click on the Save button now you're not seeing the MsgBox anymore? You did leave it there and simply set a break point to it, did you not?
Hi. Earlier, you said when you clicked on the Save button, you see the MsgBox we added. Are you saying when you click on the Save button now you're not seeing the MsgBox anymore? You did leave it there and simply set a break point to it, did you not?
Here it is, I also attached the DB now the on the main form click view then it will bring up another form and on that form click vendor reachout, that is where the problem is. I am not sure why it does not take me to debug screen anymore if there is a problem or error, it might for you but for me it does not do it anymore...
Open the VBA screen to the code you want to break on. Put the mouse cursor in the column to the left of the actual code line on which you want to break. Click it once and you should see a red dot.
Once that dot is there, if you trigger something that should execute the code. It will break BEFORE it executes the line.
Let's look at the first part of your example.
Code:
Private Sub save_Click()
'check the always required fields
[COLOR="Red"]If IsNull(Me.extdatevreachout) Or IsNull(Me.lfassessedvreachout) Or IsNull(waiverapprv) Or IsNull(reqmethod) Then[/COLOR]
[COLOR="SeaGreen"]MsgBox "Please check empty fields", _
vbCritical, _
"Canceling Update"
Me.extdatevreachout.SetFocus[/COLOR]
Cancel = True
Exit Sub
End If
I have highlighted two lines. If you put your breakpoint on the RED line, it should stop there every time you click the appropriate button. If you put your breakpoint on the GREEN line, it might not stop because of the prior IF statement for which the conditions might not be met. Therefore, it would appear to not break, when in fact you never get to the breakpoint due to program logic.
Therefore, when you say you tried to run the code but nothing happens... it could be because of breakpoint placement. If that doesn't apply, then it is also possible that your event routine isn't properly linked to that code.
Open the VBA screen to the code you want to break on. Put the mouse cursor in the column to the left of the actual code line on which you want to break. Click it once and you should see a red dot.
Once that dot is there, if you trigger something that should execute the code. It will break BEFORE it executes the line.
Let's look at the first part of your example.
Code:
Private Sub save_Click()
'check the always required fields
[COLOR="Red"]If IsNull(Me.extdatevreachout) Or IsNull(Me.lfassessedvreachout) Or IsNull(waiverapprv) Or IsNull(reqmethod) Then[/COLOR]
[COLOR="SeaGreen"]MsgBox "Please check empty fields", _
vbCritical, _
"Canceling Update"
Me.extdatevreachout.SetFocus[/COLOR]
Cancel = True
Exit Sub
End If
I have highlighted two lines. If you put your breakpoint on the RED line, it should stop there every time you click the appropriate button. If you put your breakpoint on the GREEN line, it might not stop because of the prior IF statement for which the conditions might not be met. Therefore, it would appear to not break, when in fact you never get to the breakpoint due to program logic.
Therefore, when you say you tried to run the code but nothing happens... it could be because of breakpoint placement. If that doesn't apply, then it is also possible that your event routine isn't properly linked to that code.
I tried putting the breakpoint on the line highlighted in Red. I tried to run it by clicking the button. Nothing happens.:banghead: I think may be there is something wrong with my VB, I never had debug errors recently, I just knew there was something wrong because it does not work.
I tried putting the breakpoint on the line highlighted in Red. I tried to run it by clicking the button. Nothing happens.:banghead: I think may be there is something wrong with my VB, I never had debug errors recently, I just knew there was something wrong because it does not work.
Hi. I downloaded your file and found the issue why you can't step through your code. In the Current Database Options, you have unchecked the "Use Access Special Keys" checkbox. You probably did this to prevent users from hitting the F11 key to display the Navigation Pane because the F11 key is a "special key." Unfortunately, if F11 is a special key, the F8 is also a special key. If you hover your mouse over the "info" icon next to this option, it will show that this option affects "Pause Execution." So, while troubleshooting your database, put a check on this option and just take it back out before you deploy your app to your users.
Hi. I downloaded your file and found the issue why you can't step through your code. In the Current Database Options, you have unchecked the "Use Access Special Keys" checkbox. You probably did this to prevent users from hitting the F11 key to display the Navigation Pane because the F11 key is a "special key." Unfortunately, if F11 is a special key, the F8 is also a special key. If you hover your mouse over the "info" icon next to this option, it will show that this option affects "Pause Execution." So, while troubleshooting your database, put a check on this option and just take it back out before you deploy your app to your users.
this part works, it asks value for the 3 fields if the waiverapprv is YES
If Me.waiverapprv = "Yes" And IsNull(Me.creditamnt) Or IsNull(Me.creditmethod) Or IsNull(expinvdatecredit) Then
if the value is No, it still asked for values for the other 3 that is only applicable if the waiverapprv value is YES.
ElseIf Me.waiverapprv = "No" And IsNull(Me.declinedreason) Then
It helped and I was able to correct most of the errors, I didn't know it would stop the debugging message, I was really having a hard time figuring out what could be the errors... Thank you for looking into it. Now I have another problem... the checking of fields, I am not sure if I structured the if conditions correctly.
Interesting and good to know. Way back I was going to suggest using the step button on the toolbar (probably not there by default) because F8 and F5 don't necessarily behave the same on every pc. On mine, I have to include the Fn key so I rarely use F8 over the toolbar button. I just figured it wouldn't apply, but I now suspect it would have at least allowed stepping through in this case.