Selasa, 27 Agustus 2013

RE: [MS_AccessPros] Help with Form/Combo Box

 

Sarah-

Me.Refresh recalculates the entire form! You could do a Requery of the
specific combo box, but that might cause the combo to close, so the user
could never get it to drop down. You should have to Requery only when
another form adds a record. If you feel compelled to do this, I suggest you
use Got Focus, not Mouse Down.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of novice012000
Sent: Wednesday, August 28, 2013 3:44 AM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] Help with Form/Combo Box

John, Thank you it worked.

Since the source data was a table and not a query, I thought it does not
need a refresh.

Another question: to make it easier for me (I have a lot of combo boxes on
this form), I added an event to the combo box 'on mouse down':
Private Sub ethnic_MouseDown(Button As Integer, shift As Integer, X As
Single, Y As Single) Me.Refresh End Sub This refreshes the data when the
user clicks the down-arrow of the combo box. Is it ok to-do it like this?.
Or will I have problems later on?. Should I use a different event?

As always, your input is much appreciated.
Thanks
Sarah
--- In MS_Access_Professionals@yahoogroups.com, John Viescas <JohnV@...>
wrote:
>
> Sarah-
>
> Access runs the queries that provide the Row Source for your combos
> only when you open the form. Any records you add after the form opens
> will not appear until you reopen the form or do something in code to
> force Access to rebuild the Row Source.
>
> To force a rebuild, you need to run the Requery macro action or
> execute the Requery method of the combo box in VBA code. You could do
> that from the After Update event of each form that you have pop open to
add new rows.
> Open one of your "subforms" in Design view, select the Form object,
> then open the Properties window and scroll down until you see the
> After Update property. Click in that property, then click the Build
> button (...) next to it to open a dialog asking you whether you want
> to build VBA code or a macro.
>
> If you decide to use a macro, you need two actions. First cretate a
> SelectObject action and then choose Forms and the name of the form
> with your combo boxes as the parameters. The second action is
> Requery, and you need to give it the name of the combo box control for
> which you want to rebuild the Row Source.
>
> If you decide to use VBA (by choosing Event Procedure in the Build
> dialog), you need only one line of code:
>
> Forms![name of form with combos]![name of combo control].Requery
>
> Hope that helps...
>
> John Viescas, Author
> Microsoft Access 2010 Inside Out
> Microsoft Access 2007 Inside Out
> Microsoft Access 2003 Inside Out
> Building Microsoft Access Applications SQL Queries for Mere Mortals
> http://www.viescas.com/ (Paris, France)
>
>
>
>
> -----Original Message-----
> From: MS_Access_Professionals@yahoogroups.com
> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of
> novice012000
> Sent: Monday, August 26, 2013 10:29 PM
> To: MS_Access_Professionals@yahoogroups.com
> Subject: [MS_AccessPros] Help with Form/Combo Box
>
> I need help with the following. I will explain it as best as I can. I
> am new at Access, so please excuse if I dont use the correct term/word.
>
> I have a Form that has many Combo Boxes. The combo boxes display
> entries from other tables and the user can select an entry from the other
table.
> This part works fine. When the user double clicks on the combo box, a
> sub-form is opened and the user can add entries to the other table.
> This also works fine. What does not work, is after the user closes the
> sub-form and goes back to the original form, the new entries added to
> the table that the combo box represents, dont show. Sometimes the new
> entries show up later and sometimes you need to close the whole
> application (=exit access) and got back into the form for the new
> entries to show up as a valid choice in the combo box.I checked the
> tables and the new entries are there, but they dont show up as a selection
in the combo box.
> Some of the combo boxes on the form work fine, eg,the new entry shows
> up immediately and some dont. I compared all the parameters on the
> combo boxes and on the sub-forms. They all seem the same.
> What am I doing wrong???.
> Thanks for your input
> Sarah
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>

------------------------------------

Yahoo! Groups Links

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar