Access can't find the object '.'

PB7

Board Regular
Joined
Mar 1, 2011
Messages
58
Hello, and I'm stumped by Access for about the millionth time.

Have a simple automation. To copy a line to a form, I have I believe a perfectly good module/macro as follows:

DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdPasteAppend

It worked before in another db.

When I attach the code to a checkbox button, and the user checks a row on the form to be copied, I get this mystery message:

Microsoft Office Access can't find the object '.'
If " is a new macro or macro group, make sure you have saved it, and that you have typed its name correctly.


I've tried my code both in VBA code, and in a macro.
I've tried attaching the code to On Click, BeforeUpdate, and AfterUpdate, for the checkbox.

Can see the VBA or macro attached under the Properties section of the checkbox, clear as day.

Nothing works. Have no idea what I'm doing wrong.

Mercifully, would any one be able to tell me what is wrong here???

Many thanks.
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Where exactly are you trying to drop this code? Are you putting it in the actual event in the properties box like where it says "On Click" or is this a part of VBA code?

You use the phrase "good module/macro" in your description, but these are two totally different things and that is a bit confusing.
 
Upvote 0
Montez, thanks for the reply.

This code hangs on a checkbox, within a form. The form is linked to a table. Occasionally, a record on the form needs to be copied. So, I have a column of checkboxes available, and then if a box is checked for a given record, I need that record copied to the table.

Right, my hope is, the code will kick in, after "*******". That is where I have the code sitting, per the Properties section for the checkbox.

I say both module and macro, to say, I've tried the same code in an attached VBA module, and the same exact code in an Access macro, and neither approach worked.

Thanks for the help here.

PS: I checked for db corruption, and that isn't the issue here.
 
Upvote 0
So when you have it in VBA, the event property says [Event Procedure] and when it is in macro format it says [Embedded Macro], right?

The reason I say this is because from the original post, it sounded as if you were trying to put the command in the properties box and not in VBA code. It won't work in the On Event boxes unless specifically calling VBA code and having the doCmd in the VBA code of the event.
 
Upvote 0
Montez, right, one version of my efforts here, was to create a VBA module, with all the DoCmd code, and then attach the module as an Event Procedure. That dis not work either. I get the same error message.

I could have sworn, that I had a prior database a few months ago, this same VBA code, within a code module, worked as an Event Procedure, attached to the checkbox in a form.

Now, in this new database, as I try to use the previous code verbatim, it does not work.
 
Upvote 0
Does the table (or filename for that matter) that you are trying to append to have any spaces or weird characters like "&,%,#" - anything like that? I was having a similar (but not same) error when I split my db last week and it might have had to do with those characters. Could be a similar situation here as well.

Other than that, I would try to delete the checkbox control and put it back on there. I've also experienced some weird errors that were only resolved by recreating that control.

Also, you could try copying the pieces of your db into a new one and see if that fixes it. Have you tried compacting and repairing recently?

This is about all I can think to do. I will continue to think on it for you and see if I can come up with anything different.

As a side note, I created a test control and didn't seem to come up with the error you had.
 
Upvote 0
Montez, as you suggested, I deleted the checkbox control, and re-added it to the form, and the code works fine now, as expected.

Thanks for the awesome help here.
 
Upvote 0

Forum statistics

Threads
1,224,541
Messages
6,179,418
Members
452,912
Latest member
alicemil

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top