You can't carry out this action at the present time

G

Guest

I am working on a database that is used at a number of similar organisations.
I recently added an audit trail to this using a slightly adapted version of
an example I found on this newsgroup.

This consists of calling a module BeforeUpdate which assigns any changes
into an invisible field and running the following code AfterUpdate to assign
the change into an Audit Trail table:

Private Sub Form_AfterUpdate()
On Error GoTo Err_AfterUpdate_Click

Dim strName As String, StrSql As String
Dim FormID As String
Dim Changes As String

strName = CurrentUser()
FormID = "Demographic"

StrSql = "INSERT INTO AuditTrail (ID, FormID, ChangedBy, ChangesMade) " & _
"Values ('" & [ID] & "', '" & FormID & "', '" & strName &
"', '" & tbAuditTrail & "' )"

CurrentDb().Execute StrSql

Exit_AfterUpdate_Click:
Exit Sub

Err_AfterUpdate_Click:
MsgBox Err.Description
Resume Exit_AfterUpdate_Click

End Sub


This works extremely well at most of the sites, with the exception of one
where the message "You can't carry out this action at the present time"
appears when the user closes one form after making a change to go back to
another which is still open. The forms then appear to freeze and the message
appears regardless on which command button she clicks. The user has to close
down altogether and then go back in.

The message does not show up all the time and I am having real difficulty
working out what it is trying to tell me.

The computers on the site in question use a mixture of Access 2000 and
Access 2003 so the form file is still in 2000 although the user is running
2003.

Any ideas or pointers would be seriously appreciated.

Thanks in advance
 
R

ruralguy via AccessMonster.com

You might try changing this line:
CurrentDb().Execute StrSql
to...
CurrentDb().Execute StrSql, dbFailOnError
so you can see the error.
I am working on a database that is used at a number of similar organisations.
I recently added an audit trail to this using a slightly adapted version of
an example I found on this newsgroup.

This consists of calling a module BeforeUpdate which assigns any changes
into an invisible field and running the following code AfterUpdate to assign
the change into an Audit Trail table:

Private Sub Form_AfterUpdate()
On Error GoTo Err_AfterUpdate_Click

Dim strName As String, StrSql As String
Dim FormID As String
Dim Changes As String

strName = CurrentUser()
FormID = "Demographic"

StrSql = "INSERT INTO AuditTrail (ID, FormID, ChangedBy, ChangesMade) " & _
"Values ('" & [ID] & "', '" & FormID & "', '" & strName &
"', '" & tbAuditTrail & "' )"

CurrentDb().Execute StrSql

Exit_AfterUpdate_Click:
Exit Sub

Err_AfterUpdate_Click:
MsgBox Err.Description
Resume Exit_AfterUpdate_Click

End Sub

This works extremely well at most of the sites, with the exception of one
where the message "You can't carry out this action at the present time"
appears when the user closes one form after making a change to go back to
another which is still open. The forms then appear to freeze and the message
appears regardless on which command button she clicks. The user has to close
down altogether and then go back in.

The message does not show up all the time and I am having real difficulty
working out what it is trying to tell me.

The computers on the site in question use a mixture of Access 2000 and
Access 2003 so the form file is still in 2000 although the user is running
2003.

Any ideas or pointers would be seriously appreciated.

Thanks in advance
 
G

Guest

Thanks - I'll try that to see if it makes things clearer

ruralguy via AccessMonster.com said:
You might try changing this line:
CurrentDb().Execute StrSql
to...
CurrentDb().Execute StrSql, dbFailOnError
so you can see the error.
I am working on a database that is used at a number of similar organisations.
I recently added an audit trail to this using a slightly adapted version of
an example I found on this newsgroup.

This consists of calling a module BeforeUpdate which assigns any changes
into an invisible field and running the following code AfterUpdate to assign
the change into an Audit Trail table:

Private Sub Form_AfterUpdate()
On Error GoTo Err_AfterUpdate_Click

Dim strName As String, StrSql As String
Dim FormID As String
Dim Changes As String

strName = CurrentUser()
FormID = "Demographic"

StrSql = "INSERT INTO AuditTrail (ID, FormID, ChangedBy, ChangesMade) " & _
"Values ('" & [ID] & "', '" & FormID & "', '" & strName &
"', '" & tbAuditTrail & "' )"

CurrentDb().Execute StrSql

Exit_AfterUpdate_Click:
Exit Sub

Err_AfterUpdate_Click:
MsgBox Err.Description
Resume Exit_AfterUpdate_Click

End Sub

This works extremely well at most of the sites, with the exception of one
where the message "You can't carry out this action at the present time"
appears when the user closes one form after making a change to go back to
another which is still open. The forms then appear to freeze and the message
appears regardless on which command button she clicks. The user has to close
down altogether and then go back in.

The message does not show up all the time and I am having real difficulty
working out what it is trying to tell me.

The computers on the site in question use a mixture of Access 2000 and
Access 2003 so the form file is still in 2000 although the user is running
2003.

Any ideas or pointers would be seriously appreciated.

Thanks in advance
 
G

Guest

The message I get after changing that line is

"Compile Error: Variable not defined"

I have checked through my project and on other audited forms I do have that
line complete with "dbFailOnError" and I am not getting any errors on those
forms.

Do you have any idea what I have missed?

ruralguy via AccessMonster.com said:
You might try changing this line:
CurrentDb().Execute StrSql
to...
CurrentDb().Execute StrSql, dbFailOnError
so you can see the error.
I am working on a database that is used at a number of similar organisations.
I recently added an audit trail to this using a slightly adapted version of
an example I found on this newsgroup.

This consists of calling a module BeforeUpdate which assigns any changes
into an invisible field and running the following code AfterUpdate to assign
the change into an Audit Trail table:

Private Sub Form_AfterUpdate()
On Error GoTo Err_AfterUpdate_Click

Dim strName As String, StrSql As String
Dim FormID As String
Dim Changes As String

strName = CurrentUser()
FormID = "Demographic"

StrSql = "INSERT INTO AuditTrail (ID, FormID, ChangedBy, ChangesMade) " & _
"Values ('" & [ID] & "', '" & FormID & "', '" & strName &
"', '" & tbAuditTrail & "' )"

CurrentDb().Execute StrSql

Exit_AfterUpdate_Click:
Exit Sub

Err_AfterUpdate_Click:
MsgBox Err.Description
Resume Exit_AfterUpdate_Click

End Sub

This works extremely well at most of the sites, with the exception of one
where the message "You can't carry out this action at the present time"
appears when the user closes one form after making a change to go back to
another which is still open. The forms then appear to freeze and the message
appears regardless on which command button she clicks. The user has to close
down altogether and then go back in.

The message does not show up all the time and I am having real difficulty
working out what it is trying to tell me.

The computers on the site in question use a mixture of Access 2000 and
Access 2003 so the form file is still in 2000 although the user is running
2003.

Any ideas or pointers would be seriously appreciated.

Thanks in advance
 
R

ruralguy via AccessMonster.com

It is starting to sound like this form might be a corrupt. Have you done a
Tools>Database Utilities>Compact and Repair?
The message I get after changing that line is

"Compile Error: Variable not defined"

I have checked through my project and on other audited forms I do have that
line complete with "dbFailOnError" and I am not getting any errors on those
forms.

Do you have any idea what I have missed?
You might try changing this line:
CurrentDb().Execute StrSql
[quoted text clipped - 52 lines]
 
G

Guest

Thanks for keeping in touch with me on this problem

Yes, I've tried compiling the code, compacting the database, deleting the
form and importing the original form from the unaudited form files and
putting in the audit trail code.

I'm beginning to come to the conclusion that perhaps there is a corruption
somewhere within and I'm giong to have to load the audit trail back into an
unaudited back-up.

...... unless you can give me some hope?!



ruralguy via AccessMonster.com said:
It is starting to sound like this form might be a corrupt. Have you done a
Tools>Database Utilities>Compact and Repair?
The message I get after changing that line is

"Compile Error: Variable not defined"

I have checked through my project and on other audited forms I do have that
line complete with "dbFailOnError" and I am not getting any errors on those
forms.

Do you have any idea what I have missed?
You might try changing this line:
CurrentDb().Execute StrSql
[quoted text clipped - 52 lines]
Thanks in advance

--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
 
R

ruralguy via AccessMonster.com

Have you tried a /decompile?
http://www.granite.ab.ca/access/decompile.htm

Also try creating a new, empty mdb and turn OFF Tools>Options>Geberal
tab>Name AutoCorrect. Also turn ON Compact on Close while on that tab.
Close the db and then open it again. Import everything into the new db and
then close it. Now open and try and see if you still have the same problem.

Another link to read: http://allenbrowne.com/bug-03.html
Thanks for keeping in touch with me on this problem

Yes, I've tried compiling the code, compacting the database, deleting the
form and importing the original form from the unaudited form files and
putting in the audit trail code.

I'm beginning to come to the conclusion that perhaps there is a corruption
somewhere within and I'm giong to have to load the audit trail back into an
unaudited back-up.

..... unless you can give me some hope?!
It is starting to sound like this form might be a corrupt. Have you done a
Tools>Database Utilities>Compact and Repair?
[quoted text clipped - 14 lines]
 
G

Guest

Thanks - I'll try both

ruralguy via AccessMonster.com said:
Have you tried a /decompile?
http://www.granite.ab.ca/access/decompile.htm

Also try creating a new, empty mdb and turn OFF Tools>Options>Geberal
tab>Name AutoCorrect. Also turn ON Compact on Close while on that tab.
Close the db and then open it again. Import everything into the new db and
then close it. Now open and try and see if you still have the same problem.

Another link to read: http://allenbrowne.com/bug-03.html
Thanks for keeping in touch with me on this problem

Yes, I've tried compiling the code, compacting the database, deleting the
form and importing the original form from the unaudited form files and
putting in the audit trail code.

I'm beginning to come to the conclusion that perhaps there is a corruption
somewhere within and I'm giong to have to load the audit trail back into an
unaudited back-up.

..... unless you can give me some hope?!
It is starting to sound like this form might be a corrupt. Have you done a
Tools>Database Utilities>Compact and Repair?
[quoted text clipped - 14 lines]
Thanks in advance

--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top