Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / October 2007

Tip: Looking for answers? Try searching our database.

form question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Debbie S. - 24 Oct 2007 18:44 GMT
I have two forms in a database. One is a contact details form (name, address,
phone, email etc.). The other form has a subform with a drop down that allows
you to choose names that have been entered into the contact details form.

I want to be able to enter a name into the contact form, and using a command
button, open the other form, and then choose the person's name from the drop
down in the combo box. Trouble is the record does not write until you close
the form, and the other form can't be open or the name won't be populated in
the drop down list. I tried putting a "save record" on the contact details
form but that didn't do any good. Is there a way to do this?

Thanks,
ds
Steve Schapel - 24 Oct 2007 19:27 GMT
Debbie,

Regarding "the other form can't be open or the name won't be populated
in the drop down list" is not strictly true.  You can use a line of code
like this:
Me.NameOfYourCOmboboxOnOtherForm.Requery
... to update the "drop-down list".  This code could be put, for
example, on the Enter Event of the combobox, or the Activate event of
the other form.

When you say "I tried putting a 'save record' on the contact details
form ", what does this really mean?  If you used:
DoCmd.RunCommand acCmdSaveRecord
... or:
Me.Dirty = False
... in the code behind the command button's Click event, prior to
opening the other form, I would expect this also to solve the problem -
assuming, that is, that the other form is indeed closed (as opposed to
hidden or minimised) at the time.

Signature

Steve Schapel, Microsoft Access MVP

> I have two forms in a database. One is a contact details form (name, address,
> phone, email etc.). The other form has a subform with a drop down that allows
[quoted text clipped - 9 lines]
> Thanks,
> ds
Debbie S. - 24 Oct 2007 20:02 GMT
I mean that I put a command button on the contacts form using the wizard. The
name of the button was save record. That didn't work. I subsequently figured
out that you can use a command button called "refresh." I put the refresh
button (again using the wizard) on the contacts form. I enter a name into the
form. I click the refresh button. This populates the name in a combo box that
is on the contacts form. But if the other form is open while I enter the new
data in the contacts form, even if I click the refresh button on the contacts
form, the name still does not populate in the combo box on the other form.

So let me understand: you are suggesting that I put the following line of
code:

Me.NameOfYourCOmboboxOnOtherForm.Requery

in the activate event property of the other form (which is actually a
subform on a main form)

Or do I put the code in the activate event property of the combo box on the
other form (subform)?

and once that code is in the other form I don't have to do anything else?

Please clarify, I hope this makes my question more clear to you.

Thank you. -ds
Steve Schapel - 24 Oct 2007 20:14 GMT
Debbie,

Pretty much.  But a combobox doesn't have an Activate event, you would
use the Enter event of the combobox.  Or the Activate event of the form.
 But let's just use the combobox's Enter event, that's easier.  And of
course, yoiu substitute the actual name of the combobox for
"NameOfYourCOmboboxOnOtherForm".

Signature

Steve Schapel, Microsoft Access MVP

> I mean that I put a command button on the contacts form using the wizard. The
> name of the button was save record. That didn't work. I subsequently figured
[quoted text clipped - 21 lines]
>
> Thank you. -ds
Debbie S. - 24 Oct 2007 21:00 GMT
I tried putting the code in the Enter event property of the combo box on the
other form (which is actually a subform) and it gave me an error message,
something about it could not find a "me" macro. Do I have to build a macro
first and then put the code in? What am I missing?

thx.
ds

> Debbie,
>
[quoted text clipped - 29 lines]
> >
> > Thank you. -ds
Steve Schapel - 24 Oct 2007 22:17 GMT
Debbie,

Aha!  I know what you have done.  Sorry, I made an assumption!

In the event property itself, you enter [Event Procedure], and then
click the little ellipsis [...] button to the right, which will open the
Visual Basic Editor window.  The cursor will be located by default
between 2 lines of code, and then that's where you enter what I gave
you, like this:

Private Sub YourCombobox_Enter()
    Me.YourCombobox.Requery
End Sub

Signature

Steve Schapel, Microsoft Access MVP

> I tried putting the code in the Enter event property of the combo box on the
> other form (which is actually a subform) and it gave me an error message,
> something about it could not find a "me" macro. Do I have to build a macro
> first and then put the code in? What am I missing?
Lisa - 26 Oct 2007 15:16 GMT
I have a from that users can inout ingredients for recipes. I want the user
to pick an ingredient from a drop down(which is already working). I also have
a field that has an item number. I want the item number to auto generate base
on the ingredient selected from the drop down.
Signature

Lisa S.

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.