Re: Command buttons - Access 2003
From: Nikos Yannacopoulos (nyannacoREMOVETHISBIT_at_in.gr)
Date: 09/07/04
- Next message: Bibi: "Patientnumber is displayed on form but not stored in table?"
- Previous message: Mary Ann: "Command buttons - Access 2003"
- In reply to: Mary Ann: "Command buttons - Access 2003"
- Next in thread: Mary Ann: "Re: Command buttons - Access 2003"
- Reply: Mary Ann: "Re: Command buttons - Access 2003"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 7 Sep 2004 13:40:52 +0300
Mary Ann,
I'll assume the name cboCompanies for the combo on your Contacts form, and
you'll have to change to the actual name. All you need to do is add a single
line of code to the form's On Got Focus event:
Me.cboCompanies.Requery
so when you close the Companies form and focus is set back to the Contacts
form, the combo is requeried and the newly added record is read.
HTH,
Nikos
"Mary Ann" <anonymous@discussions.microsoft.com> wrote in message
news:06a201c494c3$74f344d0$a401280a@phx.gbl...
> I have a database which has a contacts table and a
> companies table with a one to many relationship between
> contacts and companies. The database has been used so
> far to send out mailshots to prospective subscribers to a
> magazine.
>
> I have a contacts form which includes a combo box to show
> the contact's company. The combo box record source is a
> query containing the company name and some address
> fields - this is necessary because there are some
> companies with the same name but different addresses.
>
> I also have a companies form with a sub form containing
> contact details.
>
> My problem arises when I need to change the contact's
> company. A contact phones to tell me they have changed
> companies, I go to the contacts form, find the contact
> and select the new company from the company combo list.
> This is fine when the company already exists.
>
> When the company does not exist yet, I need to create a
> new company when the person is on the phone and then
> update their record. I created a command button on the
> contacts form, using the Wizard, which opens the
> companies form so I can create a new company. I then
> close the companies form and am returned to the contacts
> form showing the correct person, but the companies combo
> does not include the new company. I have tried including
> a command button on the contacts form which "Refreshes
> form data" but this does not make any difference.
>
> If I close the contacts form and reopen it the newly
> created company is present in the list - but I don't want
> to have to do this as I am then not looking at the
> correct contact record.
>
> If anyone can help I would be most grateful. I am a
> strongly competent user of Access but I don't write
> Visual Basic.
>
> Regards
>
> Mary Ann
- Next message: Bibi: "Patientnumber is displayed on form but not stored in table?"
- Previous message: Mary Ann: "Command buttons - Access 2003"
- In reply to: Mary Ann: "Command buttons - Access 2003"
- Next in thread: Mary Ann: "Re: Command buttons - Access 2003"
- Reply: Mary Ann: "Re: Command buttons - Access 2003"
- Messages sorted by: [ date ] [ thread ]