Run time error 2046

G

Guest

I've been trying to wrap my arms around this for hours now with no avail. I'm
hoping someone can shed some light on my problem. I have a job tracking form(
continuous form with permissions)that has a button to delete a record.
When I'm logged on as admin, everything works fine, the record deletes after
performing the previous steps. My users, however, get an run time error 2046
when the code hits the docmd.RunCommand acCmdDeleteRecord portion of code(.
I've ensured all the permissions are set to allow this group of users to
delete from this form,the form is set to allow deletions and permissions for
related tables are also set. Any thoughts? What could be causing this. What
is the 2046 telling me? I'm on strike three and need to get this resolved.
Any insight would be appreicated.

Thanks.
 
G

Guest

I don't know what's causing the problem but don't you get an error message as
well or just the number. Try running raise err.description(2046) in the
immediatewindow of VBA. This should tell you the description of the error.
 
G

Guest

Hi Maurice,

Sorry for the late reply, i've been out of town for a few days.

No, I don't get an error message logged in as Admin. The record gets deleted
correctly when the code is ran. Logged in as a user, when the code hits the
acCmdDeleteRecord the error "The command or action 'Delete Record' isn't
available now." No clue why this works for admin but not the user. Guessed
permissions, but they all seem to check out.
 
G

Guest

Hi Dave,

Such errors are very hard to trap. You could try deleting it yourself by
placing some code for it to see if it is possible that way. Since it is
possible to delete from the Admin version I'm assuming you haven't altered
the version when distributing the userversion.

You could try something like:

DoCmd.RunSQL "DELETE * FROM [your tablename] WHERE [Your ID-field]= " &
me.[yourID-field]

and if the ID-field is a textfield adjust it a little:

DoCmd.RunSQL "DELETE * FROM [your tablename] WHERE [Your ID-field]= '" &
me.[yourID-field] & "'"

Do al the users have the appropriate rights on the directory where the DB is
placed?
 
G

Guest

Hey Maurice,

Yes I agree as I'm still having no luck. I'll try what you suggested below.
Regarding
folder/directory permissions, everyone has all the necessary rights.

I'll try your suggestion and see what happens.

Thanks

Dave







Maurice said:
Hi Dave,

Such errors are very hard to trap. You could try deleting it yourself by
placing some code for it to see if it is possible that way. Since it is
possible to delete from the Admin version I'm assuming you haven't altered
the version when distributing the userversion.

You could try something like:

DoCmd.RunSQL "DELETE * FROM [your tablename] WHERE [Your ID-field]= " &
me.[yourID-field]

and if the ID-field is a textfield adjust it a little:

DoCmd.RunSQL "DELETE * FROM [your tablename] WHERE [Your ID-field]= '" &
me.[yourID-field] & "'"

Do al the users have the appropriate rights on the directory where the DB is
placed?

--
Maurice Ausum


Dave said:
Hi Maurice,

Sorry for the late reply, i've been out of town for a few days.

No, I don't get an error message logged in as Admin. The record gets deleted
correctly when the code is ran. Logged in as a user, when the code hits the
acCmdDeleteRecord the error "The command or action 'Delete Record' isn't
available now." No clue why this works for admin but not the user. Guessed
permissions, but they all seem to check out.
 
G

Guest

Hi Maurcie,

The DoCmd.RunSQL "DELETE * FROM worked deleting the record. One minor issue
left. After the delete occurs, I get an error 3021 indicating no current
record.
I'm assuming this is because the list box after update event listed below.
After the delete, the code errors on the last line below because the
recordset is now gone. Any thoughts on how i can bypass this after update
procedure initally after the delete and return to it when there is a
selectable record? Not sure why i didn't get
this error with docmd.RunCommand acCmdDeleteRecord.
Private Sub List1501_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[job] = """ & Me.List1476 & """"
Me.Bookmark = rs.Bookmark

Thanks for your help...



Maurice said:
Hi Dave,

Such errors are very hard to trap. You could try deleting it yourself by
placing some code for it to see if it is possible that way. Since it is
possible to delete from the Admin version I'm assuming you haven't altered
the version when distributing the userversion.

You could try something like:

DoCmd.RunSQL "DELETE * FROM [your tablename] WHERE [Your ID-field]= " &
me.[yourID-field]

and if the ID-field is a textfield adjust it a little:

DoCmd.RunSQL "DELETE * FROM [your tablename] WHERE [Your ID-field]= '" &
me.[yourID-field] & "'"

Do al the users have the appropriate rights on the directory where the DB is
placed?

--
Maurice Ausum


Dave said:
Hi Maurice,

Sorry for the late reply, i've been out of town for a few days.

No, I don't get an error message logged in as Admin. The record gets deleted
correctly when the code is ran. Logged in as a user, when the code hits the
acCmdDeleteRecord the error "The command or action 'Delete Record' isn't
available now." No clue why this works for admin but not the user. Guessed
permissions, but they all seem to check out.
 
G

Guest

Dave,

I'm having the same problem and error message. I have gotten around it by
using a "Macro" wich simply states "RunCommand DeleteRecord". Exactly the
same as the VBA code.

Dean
 

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

Similar Threads


Top