If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
No current record?
Hello,
In a textbox of a continuous subform I have this code in the BeforeUpdate event: Private Sub EmailAdddress_BeforeUpdate(Cancel As Integer) On Error GoTo errSec If GetUserLevel() "admin" Then Cancel = True MsgBox "Only an Administrator can change email addresses from this form!" Me.Undo End If exitSec: Exit Sub errSec: MsgBox "Error " & Err & ": " & Err.Description Resume Next End Sub When this runs and the user is not "admin" I get a message box which says, "No current record." w/o quotes and no err number. The problem is the undo method. I have tried, DoCmd.RunCommand acCmdUndo and [EmailAdddress].Undo with the same result. This is an A2002 mdb database, opened with A2007. Thanks for any help and God Bless, Mark A. Sam |
#2
|
|||
|
|||
No current record?
put this statement:
Cancel = true before Me.Undo if you are only wanting to undo the email address control, use: me.EmailAdddress.undo Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.accessmvp.com/Strive4Peace/Index.htm * (: have an awesome day * Mark A. Sam wrote: Hello, In a textbox of a continuous subform I have this code in the BeforeUpdate event: Private Sub EmailAdddress_BeforeUpdate(Cancel As Integer) On Error GoTo errSec If GetUserLevel() "admin" Then Cancel = True MsgBox "Only an Administrator can change email addresses from this form!" Me.Undo End If exitSec: Exit Sub errSec: MsgBox "Error " & Err & ": " & Err.Description Resume Next End Sub When this runs and the user is not "admin" I get a message box which says, "No current record." w/o quotes and no err number. The problem is the undo method. I have tried, DoCmd.RunCommand acCmdUndo and [EmailAdddress].Undo with the same result. This is an A2002 mdb database, opened with A2007. Thanks for any help and God Bless, Mark A. Sam |
#3
|
|||
|
|||
No current record?
Hello Crystal,
What you have stated is how my code is in my posting, Cancel = True is before Me.Undo. I have already tried, [EmailAdddress].Undo as well as DoCmd.RunCommand acCmdUndo I also decompiled my DB. Thanks for your response and God Bless, Mark "strive4peace" wrote in message ... put this statement: Cancel = true before Me.Undo if you are only wanting to undo the email address control, use: me.EmailAdddress.undo Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.accessmvp.com/Strive4Peace/Index.htm * (: have an awesome day * Mark A. Sam wrote: Hello, In a textbox of a continuous subform I have this code in the BeforeUpdate event: Private Sub EmailAdddress_BeforeUpdate(Cancel As Integer) On Error GoTo errSec If GetUserLevel() "admin" Then Cancel = True MsgBox "Only an Administrator can change email addresses from this form!" Me.Undo End If exitSec: Exit Sub errSec: MsgBox "Error " & Err & ": " & Err.Description Resume Next End Sub When this runs and the user is not "admin" I get a message box which says, "No current record." w/o quotes and no err number. The problem is the undo method. I have tried, DoCmd.RunCommand acCmdUndo and [EmailAdddress].Undo with the same result. This is an A2002 mdb database, opened with A2007. Thanks for any help and God Bless, Mark A. Sam |
#4
|
|||
|
|||
No current record?
Hi Mark,
what code do you have on the form Current event? also, put an error handler in ... the error may not be in this procedure ... Which statement is causing the problem? Add an error handler to your code put this at the top of your program, right after the procedure declaration (skip a line first for better readability) then come the statements of your procedure then the lines at the bottom -- be sure to replace ProcedureName '~~~~~~~~~ Error handler code ~~~~~~~~~ 'set up Error Handler On Error GoTo Proc_Err 'statements Proc_Exit: On Error Resume Next 'close and release object variables Exit function Proc_Err: MsgBox Err.Description, , _ "ERROR " & Err.Number _ & " ProcedureName" Resume Proc_Exit 'if you want to single-step code to find error, CTRL-Break at MsgBox 'then set this to be the next statement Resume '~~~~~~~~~~~~~~~~~~~~~~` where ProcedureName is the name of your procedure so you can identify what code the problem is in when you see the error The line labels do not matter (Proc_Exit:, Proc_Err, I like to use the same ones all the time -- they only have to be unique within a procedure. if you get an error, press CTRL-BREAK when the message box pops up, Enter to dismiss the dialog box this takes you into the code right-click on the [color:blue]Resume[/color] statement from the shortcut menu, choose -- Set Next Statement then press F8 to resume with the statement that caused the problem pressing F8 executes one statement at a time press F5 to continue execution automatically ~~~ While I am developing, I like to make the error handler go to the line that caused the problem so I can see where it is. Stop will stop the code and Resume goes back to the offending line. When code Stops, press F8 to execute one statement at a time. Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.accessmvp.com/Strive4Peace/Index.htm * (: have an awesome day * Mark A. Sam wrote: Hello Crystal, What you have stated is how my code is in my posting, Cancel = True is before Me.Undo. I have already tried, [EmailAdddress].Undo as well as DoCmd.RunCommand acCmdUndo I also decompiled my DB. Thanks for your response and God Bless, Mark "strive4peace" wrote in message ... put this statement: Cancel = true before Me.Undo if you are only wanting to undo the email address control, use: me.EmailAdddress.undo Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.accessmvp.com/Strive4Peace/Index.htm * (: have an awesome day * Mark A. Sam wrote: Hello, In a textbox of a continuous subform I have this code in the BeforeUpdate event: Private Sub EmailAdddress_BeforeUpdate(Cancel As Integer) On Error GoTo errSec If GetUserLevel() "admin" Then Cancel = True MsgBox "Only an Administrator can change email addresses from this form!" Me.Undo End If exitSec: Exit Sub errSec: MsgBox "Error " & Err & ": " & Err.Description Resume Next End Sub When this runs and the user is not "admin" I get a message box which says, "No current record." w/o quotes and no err number. The problem is the undo method. I have tried, DoCmd.RunCommand acCmdUndo and [EmailAdddress].Undo with the same result. This is an A2002 mdb database, opened with A2007. Thanks for any help and God Bless, Mark A. Sam |
#5
|
|||
|
|||
No current record?
Crystal,
I 'm not sure if you noticed that I posted my procedure in my first message and it contained an error handler. I'm an experienced developer. This gave me no error number and resume next didn't eliminate the problem. I've come to the conclusion that the module is likely corrupted. I'll just rebuild the form. I have another app on a remote server in another version of Access which bombed out on me also, and I just updated a backup and its fine. This will be too. Thanks for your input. God Bless, Mark "strive4peace" wrote in message ... Hi Mark, what code do you have on the form Current event? also, put an error handler in ... the error may not be in this procedure ... Which statement is causing the problem? Add an error handler to your code put this at the top of your program, right after the procedure declaration (skip a line first for better readability) then come the statements of your procedure then the lines at the bottom -- be sure to replace ProcedureName '~~~~~~~~~ Error handler code ~~~~~~~~~ 'set up Error Handler On Error GoTo Proc_Err 'statements Proc_Exit: On Error Resume Next 'close and release object variables Exit function Proc_Err: MsgBox Err.Description, , _ "ERROR " & Err.Number _ & " ProcedureName" Resume Proc_Exit 'if you want to single-step code to find error, CTRL-Break at MsgBox 'then set this to be the next statement Resume '~~~~~~~~~~~~~~~~~~~~~~` where ProcedureName is the name of your procedure so you can identify what code the problem is in when you see the error The line labels do not matter (Proc_Exit:, Proc_Err, I like to use the same ones all the time -- they only have to be unique within a procedure. if you get an error, press CTRL-BREAK when the message box pops up, Enter to dismiss the dialog box this takes you into the code right-click on the [color:blue]Resume statement from the shortcut menu, choose -- Set Next Statement then press F8 to resume with the statement that caused the problem pressing F8 executes one statement at a time press F5 to continue execution automatically ~~~ While I am developing, I like to make the error handler go to the line that caused the problem so I can see where it is. Stop will stop the code and Resume goes back to the offending line. When code Stops, press F8 to execute one statement at a time. Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.accessmvp.com/Strive4Peace/Index.htm * (: have an awesome day * Mark A. Sam wrote: Hello Crystal, What you have stated is how my code is in my posting, Cancel = True is before Me.Undo. I have already tried, [EmailAdddress].Undo as well as DoCmd.RunCommand acCmdUndo I also decompiled my DB. Thanks for your response and God Bless, Mark "strive4peace" wrote in message ... put this statement: Cancel = true before Me.Undo if you are only wanting to undo the email address control, use: me.EmailAdddress.undo Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.accessmvp.com/Strive4Peace/Index.htm * (: have an awesome day * Mark A. Sam wrote: Hello, In a textbox of a continuous subform I have this code in the BeforeUpdate event: Private Sub EmailAdddress_BeforeUpdate(Cancel As Integer) On Error GoTo errSec If GetUserLevel() "admin" Then Cancel = True MsgBox "Only an Administrator can change email addresses from this form!" Me.Undo End If exitSec: Exit Sub errSec: MsgBox "Error " & Err & ": " & Err.Description Resume Next End Sub When this runs and the user is not "admin" I get a message box which says, "No current record." w/o quotes and no err number. The problem is the undo method. I have tried, DoCmd.RunCommand acCmdUndo and [EmailAdddress].Undo with the same result. This is an A2002 mdb database, opened with A2007. Thanks for any help and God Bless, Mark A. Sam [/color] |
#6
|
|||
|
|||
No current record?
hi Mark,
with all due respect, why do you use Resume Next ? all your handler does is SKIP the line with the problem and move on to the next ... so you cannot tell what line is causing the problem -- look at the error handler code I gave you -- and read how to set it on the line with the problem in the comments I put after the code whenever you get an error message, you need to know WHICH statement caused it... Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.accessmvp.com/Strive4Peace/Index.htm * (: have an awesome day * Mark A. Sam wrote: Crystal, I 'm not sure if you noticed that I posted my procedure in my first message and it contained an error handler. I'm an experienced developer. This gave me no error number and resume next didn't eliminate the problem. I've come to the conclusion that the module is likely corrupted. I'll just rebuild the form. I have another app on a remote server in another version of Access which bombed out on me also, and I just updated a backup and its fine. This will be too. Thanks for your input. God Bless, Mark "strive4peace" wrote in message ... Hi Mark, what code do you have on the form Current event? also, put an error handler in ... the error may not be in this procedure ... Which statement is causing the problem? Add an error handler to your code put this at the top of your program, right after the procedure declaration (skip a line first for better readability) then come the statements of your procedure then the lines at the bottom -- be sure to replace ProcedureName '~~~~~~~~~ Error handler code ~~~~~~~~~ 'set up Error Handler On Error GoTo Proc_Err 'statements Proc_Exit: On Error Resume Next 'close and release object variables Exit function Proc_Err: MsgBox Err.Description, , _ "ERROR " & Err.Number _ & " ProcedureName" Resume Proc_Exit 'if you want to single-step code to find error, CTRL-Break at MsgBox 'then set this to be the next statement Resume '~~~~~~~~~~~~~~~~~~~~~~` where ProcedureName is the name of your procedure so you can identify what code the problem is in when you see the error The line labels do not matter (Proc_Exit:, Proc_Err, I like to use the same ones all the time -- they only have to be unique within a procedure. if you get an error, press CTRL-BREAK when the message box pops up, Enter to dismiss the dialog box this takes you into the code right-click on the [color:blue]Resume statement from the shortcut menu, choose -- Set Next Statement then press F8 to resume with the statement that caused the problem pressing F8 executes one statement at a time press F5 to continue execution automatically ~~~ While I am developing, I like to make the error handler go to the line that caused the problem so I can see where it is. Stop will stop the code and Resume goes back to the offending line. When code Stops, press F8 to execute one statement at a time. Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.accessmvp.com/Strive4Peace/Index.htm * (: have an awesome day * Mark A. Sam wrote: Hello Crystal, What you have stated is how my code is in my posting, Cancel = True is before Me.Undo. I have already tried, [EmailAdddress].Undo as well as DoCmd.RunCommand acCmdUndo I also decompiled my DB. Thanks for your response and God Bless, Mark "strive4peace" wrote in message ... put this statement: Cancel = true before Me.Undo if you are only wanting to undo the email address control, use: me.EmailAdddress.undo Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.accessmvp.com/Strive4Peace/Index.htm * (: have an awesome day * Mark A. Sam wrote: Hello, In a textbox of a continuous subform I have this code in the BeforeUpdate event: Private Sub EmailAdddress_BeforeUpdate(Cancel As Integer) On Error GoTo errSec If GetUserLevel() "admin" Then Cancel = True MsgBox "Only an Administrator can change email addresses from this form!" Me.Undo End If exitSec: Exit Sub errSec: MsgBox "Error " & Err & ": " & Err.Description Resume Next End Sub When this runs and the user is not "admin" I get a message box which says, "No current record." w/o quotes and no err number. The problem is the undo method. I have tried, DoCmd.RunCommand acCmdUndo and [EmailAdddress].Undo with the same result. This is an A2002 mdb database, opened with A2007. Thanks for any help and God Bless, Mark A. Sam [/color] |
#7
|
|||
|
|||
No current record?
Crystal,
I used Resume Next, becuase there was no err number to trap, and I wanted to suppress the message. The procedure works fine, other than the message coming up for no apparent reason. You don't need error handling in every situation. I don't use it for short, routine procedures unless there is a problem to discern. God Bless, Mark "strive4peace" wrote in message ... hi Mark, with all due respect, why do you use Resume Next ? all your handler does is SKIP the line with the problem and move on to the next ... so you cannot tell what line is causing the problem -- look at the error handler code I gave you -- and read how to set it on the line with the problem in the comments I put after the code whenever you get an error message, you need to know WHICH statement caused it... Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.accessmvp.com/Strive4Peace/Index.htm * (: have an awesome day * Mark A. Sam wrote: Crystal, I 'm not sure if you noticed that I posted my procedure in my first message and it contained an error handler. I'm an experienced developer. This gave me no error number and resume next didn't eliminate the problem. I've come to the conclusion that the module is likely corrupted. I'll just rebuild the form. I have another app on a remote server in another version of Access which bombed out on me also, and I just updated a backup and its fine. This will be too. Thanks for your input. God Bless, Mark "strive4peace" wrote in message ... Hi Mark, what code do you have on the form Current event? also, put an error handler in ... the error may not be in this procedure ... Which statement is causing the problem? Add an error handler to your code put this at the top of your program, right after the procedure declaration (skip a line first for better readability) then come the statements of your procedure then the lines at the bottom -- be sure to replace ProcedureName '~~~~~~~~~ Error handler code ~~~~~~~~~ 'set up Error Handler On Error GoTo Proc_Err 'statements Proc_Exit: On Error Resume Next 'close and release object variables Exit function Proc_Err: MsgBox Err.Description, , _ "ERROR " & Err.Number _ & " ProcedureName" Resume Proc_Exit 'if you want to single-step code to find error, CTRL-Break at MsgBox 'then set this to be the next statement Resume '~~~~~~~~~~~~~~~~~~~~~~` where ProcedureName is the name of your procedure so you can identify what code the problem is in when you see the error The line labels do not matter (Proc_Exit:, Proc_Err, I like to use the same ones all the time -- they only have to be unique within a procedure. if you get an error, press CTRL-BREAK when the message box pops up, Enter to dismiss the dialog box this takes you into the code right-click on the [color:blue]Resume statement from the shortcut menu, choose -- Set Next Statement then press F8 to resume with the statement that caused the problem pressing F8 executes one statement at a time press F5 to continue execution automatically ~~~ While I am developing, I like to make the error handler go to the line that caused the problem so I can see where it is. Stop will stop the code and Resume goes back to the offending line. When code Stops, press F8 to execute one statement at a time. Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.accessmvp.com/Strive4Peace/Index.htm * (: have an awesome day * Mark A. Sam wrote: Hello Crystal, What you have stated is how my code is in my posting, Cancel = True is before Me.Undo. I have already tried, [EmailAdddress].Undo as well as DoCmd.RunCommand acCmdUndo I also decompiled my DB. Thanks for your response and God Bless, Mark "strive4peace" wrote in message ... put this statement: Cancel = true before Me.Undo if you are only wanting to undo the email address control, use: me.EmailAdddress.undo Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.accessmvp.com/Strive4Peace/Index.htm * (: have an awesome day * Mark A. Sam wrote: Hello, In a textbox of a continuous subform I have this code in the BeforeUpdate event: Private Sub EmailAdddress_BeforeUpdate(Cancel As Integer) On Error GoTo errSec If GetUserLevel() "admin" Then Cancel = True MsgBox "Only an Administrator can change email addresses from this form!" Me.Undo End If exitSec: Exit Sub errSec: MsgBox "Error " & Err & ": " & Err.Description Resume Next End Sub When this runs and the user is not "admin" I get a message box which says, "No current record." w/o quotes and no err number. The problem is the undo method. I have tried, DoCmd.RunCommand acCmdUndo and [EmailAdddress].Undo with the same result. This is an A2002 mdb database, opened with A2007. Thanks for any help and God Bless, Mark A. Sam [/color] |
#8
|
|||
|
|||
No current record?
Hi Mark,
sometimes chasing down these errors can be intense! When I get one that I do not know where it comes from, I start putting error handlers everywhere. Like you, I normally do not put them in code I think would not have a problem. another option you may want to explore is to set the default to Break on All Errors the 'No current record' error message indicates that, somewhere, you have a reference to a record or control where there is none -- check RowSource of a combos and listboxes too did you compile the code? Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.accessmvp.com/Strive4Peace/Index.htm * (: have an awesome day * Mark A. Sam wrote: Crystal, I used Resume Next, becuase there was no err number to trap, and I wanted to suppress the message. The procedure works fine, other than the message coming up for no apparent reason. You don't need error handling in every situation. I don't use it for short, routine procedures unless there is a problem to discern. God Bless, Mark "strive4peace" wrote in message ... hi Mark, with all due respect, why do you use Resume Next ? all your handler does is SKIP the line with the problem and move on to the next ... so you cannot tell what line is causing the problem -- look at the error handler code I gave you -- and read how to set it on the line with the problem in the comments I put after the code whenever you get an error message, you need to know WHICH statement caused it... Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.accessmvp.com/Strive4Peace/Index.htm * (: have an awesome day * Mark A. Sam wrote: Crystal, I 'm not sure if you noticed that I posted my procedure in my first message and it contained an error handler. I'm an experienced developer. This gave me no error number and resume next didn't eliminate the problem. I've come to the conclusion that the module is likely corrupted. I'll just rebuild the form. I have another app on a remote server in another version of Access which bombed out on me also, and I just updated a backup and its fine. This will be too. Thanks for your input. God Bless, Mark "strive4peace" wrote in message ... Hi Mark, what code do you have on the form Current event? also, put an error handler in ... the error may not be in this procedure ... Which statement is causing the problem? Add an error handler to your code put this at the top of your program, right after the procedure declaration (skip a line first for better readability) then come the statements of your procedure then the lines at the bottom -- be sure to replace ProcedureName '~~~~~~~~~ Error handler code ~~~~~~~~~ 'set up Error Handler On Error GoTo Proc_Err 'statements Proc_Exit: On Error Resume Next 'close and release object variables Exit function Proc_Err: MsgBox Err.Description, , _ "ERROR " & Err.Number _ & " ProcedureName" Resume Proc_Exit 'if you want to single-step code to find error, CTRL-Break at MsgBox 'then set this to be the next statement Resume '~~~~~~~~~~~~~~~~~~~~~~` where ProcedureName is the name of your procedure so you can identify what code the problem is in when you see the error The line labels do not matter (Proc_Exit:, Proc_Err, I like to use the same ones all the time -- they only have to be unique within a procedure. if you get an error, press CTRL-BREAK when the message box pops up, Enter to dismiss the dialog box this takes you into the code right-click on the [color:blue]Resume statement from the shortcut menu, choose -- Set Next Statement then press F8 to resume with the statement that caused the problem pressing F8 executes one statement at a time press F5 to continue execution automatically ~~~ While I am developing, I like to make the error handler go to the line that caused the problem so I can see where it is. Stop will stop the code and Resume goes back to the offending line. When code Stops, press F8 to execute one statement at a time. Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.accessmvp.com/Strive4Peace/Index.htm * (: have an awesome day * Mark A. Sam wrote: Hello Crystal, What you have stated is how my code is in my posting, Cancel = True is before Me.Undo. I have already tried, [EmailAdddress].Undo as well as DoCmd.RunCommand acCmdUndo I also decompiled my DB. Thanks for your response and God Bless, Mark "strive4peace" wrote in message ... put this statement: Cancel = true before Me.Undo if you are only wanting to undo the email address control, use: me.EmailAdddress.undo Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.accessmvp.com/Strive4Peace/Index.htm * (: have an awesome day * Mark A. Sam wrote: Hello, In a textbox of a continuous subform I have this code in the BeforeUpdate event: Private Sub EmailAdddress_BeforeUpdate(Cancel As Integer) On Error GoTo errSec If GetUserLevel() "admin" Then Cancel = True MsgBox "Only an Administrator can change email addresses from this form!" Me.Undo End If exitSec: Exit Sub errSec: MsgBox "Error " & Err & ": " & Err.Description Resume Next End Sub When this runs and the user is not "admin" I get a message box which says, "No current record." w/o quotes and no err number. The problem is the undo method. I have tried, DoCmd.RunCommand acCmdUndo and [EmailAdddress].Undo with the same result. This is an A2002 mdb database, opened with A2007. Thanks for any help and God Bless, Mark A. Sam [/color] |
#9
|
|||
|
|||
No current record?
Crystal,
I know this is corruption. I broke the coke on the first line, and when I stop the code (still on the first line), the message popped up. Trying to debug would be a waste of time. I really shouldn't have posted this, but I tend to forget about corruption. God Bless, Mark "strive4peace" wrote in message ... Hi Mark, sometimes chasing down these errors can be intense! When I get one that I do not know where it comes from, I start putting error handlers everywhere. Like you, I normally do not put them in code I think would not have a problem. another option you may want to explore is to set the default to Break on All Errors the 'No current record' error message indicates that, somewhere, you have a reference to a record or control where there is none -- check RowSource of a combos and listboxes too did you compile the code? Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.accessmvp.com/Strive4Peace/Index.htm * (: have an awesome day * Mark A. Sam wrote: Crystal, I used Resume Next, becuase there was no err number to trap, and I wanted to suppress the message. The procedure works fine, other than the message coming up for no apparent reason. You don't need error handling in every situation. I don't use it for short, routine procedures unless there is a problem to discern. God Bless, Mark "strive4peace" wrote in message ... hi Mark, with all due respect, why do you use Resume Next ? all your handler does is SKIP the line with the problem and move on to the next ... so you cannot tell what line is causing the problem -- look at the error handler code I gave you -- and read how to set it on the line with the problem in the comments I put after the code whenever you get an error message, you need to know WHICH statement caused it... Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.accessmvp.com/Strive4Peace/Index.htm * (: have an awesome day * Mark A. Sam wrote: Crystal, I 'm not sure if you noticed that I posted my procedure in my first message and it contained an error handler. I'm an experienced developer. This gave me no error number and resume next didn't eliminate the problem. I've come to the conclusion that the module is likely corrupted. I'll just rebuild the form. I have another app on a remote server in another version of Access which bombed out on me also, and I just updated a backup and its fine. This will be too. Thanks for your input. God Bless, Mark "strive4peace" wrote in message ... Hi Mark, what code do you have on the form Current event? also, put an error handler in ... the error may not be in this procedure ... Which statement is causing the problem? Add an error handler to your code put this at the top of your program, right after the procedure declaration (skip a line first for better readability) then come the statements of your procedure then the lines at the bottom -- be sure to replace ProcedureName '~~~~~~~~~ Error handler code ~~~~~~~~~ 'set up Error Handler On Error GoTo Proc_Err 'statements Proc_Exit: On Error Resume Next 'close and release object variables Exit function Proc_Err: MsgBox Err.Description, , _ "ERROR " & Err.Number _ & " ProcedureName" Resume Proc_Exit 'if you want to single-step code to find error, CTRL-Break at MsgBox 'then set this to be the next statement Resume '~~~~~~~~~~~~~~~~~~~~~~` where ProcedureName is the name of your procedure so you can identify what code the problem is in when you see the error The line labels do not matter (Proc_Exit:, Proc_Err, I like to use the same ones all the time -- they only have to be unique within a procedure. if you get an error, press CTRL-BREAK when the message box pops up, Enter to dismiss the dialog box this takes you into the code right-click on the [color:blue]Resume statement from the shortcut menu, choose -- Set Next Statement then press F8 to resume with the statement that caused the problem pressing F8 executes one statement at a time press F5 to continue execution automatically ~~~ While I am developing, I like to make the error handler go to the line that caused the problem so I can see where it is. Stop will stop the code and Resume goes back to the offending line. When code Stops, press F8 to execute one statement at a time. Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.accessmvp.com/Strive4Peace/Index.htm * (: have an awesome day * Mark A. Sam wrote: Hello Crystal, What you have stated is how my code is in my posting, Cancel = True is before Me.Undo. I have already tried, [EmailAdddress].Undo as well as DoCmd.RunCommand acCmdUndo I also decompiled my DB. Thanks for your response and God Bless, Mark "strive4peace" wrote in message ... put this statement: Cancel = true before Me.Undo if you are only wanting to undo the email address control, use: me.EmailAdddress.undo Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.accessmvp.com/Strive4Peace/Index.htm * (: have an awesome day * Mark A. Sam wrote: Hello, In a textbox of a continuous subform I have this code in the BeforeUpdate event: Private Sub EmailAdddress_BeforeUpdate(Cancel As Integer) On Error GoTo errSec If GetUserLevel() "admin" Then Cancel = True MsgBox "Only an Administrator can change email addresses from this form!" Me.Undo End If exitSec: Exit Sub errSec: MsgBox "Error " & Err & ": " & Err.Description Resume Next End Sub When this runs and the user is not "admin" I get a message box which says, "No current record." w/o quotes and no err number. The problem is the undo method. I have tried, DoCmd.RunCommand acCmdUndo and [EmailAdddress].Undo with the same result. This is an A2002 mdb database, opened with A2007. Thanks for any help and God Bless, Mark A. Sam [/color] |
#10
|
|||
|
|||
No current record?
you're welcome, Mark
remember to always compile code before you execute it smile ... not doing this can lead to corruption Warm Regards, Crystal Access Basics 8-part free tutorial that covers essentials in Access http://www.accessmvp.com/Strive4Peace/Index.htm * (: have an awesome day * Mark A. Sam wrote: Crystal, I know this is corruption. I broke the coke on the first line, and when I stop the code (still on the first line), the message popped up. Trying to debug would be a waste of time. I really shouldn't have posted this, but I tend to forget about corruption. God Bless, Mark |
|
Thread Tools | |
Display Modes | |
|
|