PC Review


Reply
Thread Tools Rate Thread

Create a New Contact Button Macro in Subform

 
 
amjjam
Guest
Posts: n/a
 
      25th Apr 2009
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
 
Reply With Quote
 
 
 
 
tina
Guest
Posts: n/a
 
      25th Apr 2009
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


"amjjam" <(E-Mail Removed)> wrote in message
news:0DEBBFE7-3A7C-4A3E-8BDE-(E-Mail Removed)...
> 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



 
Reply With Quote
 
amjjam
Guest
Posts: n/a
 
      26th Apr 2009
Thanks, Tina! This works now!

"tina" wrote:

> 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
>
>
> "amjjam" <(E-Mail Removed)> wrote in message
> news:0DEBBFE7-3A7C-4A3E-8BDE-(E-Mail Removed)...
> > 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

>
>
>

 
Reply With Quote
 
tina
Guest
Posts: n/a
 
      26th Apr 2009
you're welcome


"amjjam" <(E-Mail Removed)> wrote in message
news:E3618F6A-2698-4877-867C-(E-Mail Removed)...
> Thanks, Tina! This works now!
>
> "tina" wrote:
>
> > 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
> >
> >
> > "amjjam" <(E-Mail Removed)> wrote in message
> > news:0DEBBFE7-3A7C-4A3E-8BDE-(E-Mail Removed)...
> > > 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

> >
> >
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create a button with a macro vba franco monte Microsoft Excel New Users 0 7th Mar 2010 07:53 PM
Create a macro to go to a field within a subform =?Utf-8?B?c2N1YmFkaXZlcg==?= Microsoft Access Macros 4 4th Jul 2006 01:34 PM
How do I create a macro to carry forward values from a subform? =?Utf-8?B?VGFueWhhcnQ=?= Microsoft Access Forms 1 26th May 2006 09:02 PM
How do I create a new record in a subform using a macro? =?Utf-8?B?Unlhbg==?= Microsoft Access Forms 0 19th Oct 2005 06:55 PM
Create contact with a macro Martin Studer Microsoft Outlook Contacts 1 1st Mar 2004 01:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:07 AM.