Create a New Contact Button Macro in Subform

  • Thread starter Thread starter amjjam
  • Start date Start date
A

amjjam

Hi,

My Access 2003 db contains a company form with a contacts subform. It's set
up that way so that if I have multiple contacts all of whom work for the same
company, I don't need to re-enter company information each time and so I can
query for a list of people who work for a given organization. I'd like to
have a command button on the contacts subform which creates a new contact.
I've written the macro for the contacts form. The "Create a New Contact"
control button is set to run it on click. The Action is GoToRecord; the
Object Type is Form; the Object Name is Contacts; the Record is New. When I
try to run the macro by clicking on the button in the subform, I get an error
message which reads, "The macro you are running (directly or indirectly)
contains a GoToRecord, Repaint Object, or Select Object action, but the
Object Name argument names an object that is closed. The object name argument
for the GoToRecord, Repaint Object, or Select Object method names an object
that is closed. Use one of the Open actions or methods to open the object so
that you can carry out the desired action." Would you please help me fix
this? Do I need to use an OpenForm Action (or some other Action) instead of
GoToRecord? The button to "Delete the Current Contact" works fine - allowing
the current contact to be deleted from a company's list of employees while
still retaining the company information for each of the remaining contact
records. So the contacts subform is being recognized by that macro, but not
by the "Create a New Contact" macro. Thanks for any help, amjjam
 
since you're calling the macro from the subform, and want to execute the
action in that same subform, you should be able to leave the ObjectType and
ObjectName arguments blank. read up on the GoToRecord Action topic in Access
Help.

hth
 
Thanks, Tina! This works now!

tina said:
since you're calling the macro from the subform, and want to execute the
action in that same subform, you should be able to leave the ObjectType and
ObjectName arguments blank. read up on the GoToRecord Action topic in Access
Help.

hth
 
Back
Top