Listbox refresh issue

I have an Access 2007 form that contains a combobox for selecting events, two 
listboxes, one with the names of contacts registered for the event selected 
in the combobox, the other with a list of all contacts.  I have two command 
buttons; one to add a selected contact to the list of registrants for the 
event, the other to remove a contact from the list of registrants.  Both of 
the command buttons work, but after either adding a contact or removing a 
contact the listbox of registrants will not refresh without me manually 
selecting the event again from the combobox.  I have tried using Refresh and 
Requery, but can't seem to figure out how to get this to work.  Any help will 
be greatly appreciated.

Ken
0
Utf
3/11/2008 2:01:01 PM
access.formscoding 7493 articles. 0 followers. Follow

5 Replies
1129 Views

Similar Articles

[PageSpeed] 36

Requery the list box in the Click event of the command button, after  you 
have added or removed the entry.
-- 
Dave Hargis, Microsoft Access MVP


"Ken Warthen" wrote:

> I have an Access 2007 form that contains a combobox for selecting events, two 
> listboxes, one with the names of contacts registered for the event selected 
> in the combobox, the other with a list of all contacts.  I have two command 
> buttons; one to add a selected contact to the list of registrants for the 
> event, the other to remove a contact from the list of registrants.  Both of 
> the command buttons work, but after either adding a contact or removing a 
> contact the listbox of registrants will not refresh without me manually 
> selecting the event again from the combobox.  I have tried using Refresh and 
> Requery, but can't seem to figure out how to get this to work.  Any help will 
> be greatly appreciated.
> 
> Ken
0
Utf
3/11/2008 3:36:00 PM
Do you have any event code in the ComboBox?

Ken Warthen wrote:
>I have an Access 2007 form that contains a combobox for selecting events, two 
>listboxes, one with the names of contacts registered for the event selected 
>in the combobox, the other with a list of all contacts.  I have two command 
>buttons; one to add a selected contact to the list of registrants for the 
>event, the other to remove a contact from the list of registrants.  Both of 
>the command buttons work, but after either adding a contact or removing a 
>contact the listbox of registrants will not refresh without me manually 
>selecting the event again from the combobox.  I have tried using Refresh and 
>Requery, but can't seem to figure out how to get this to work.  Any help will 
>be greatly appreciated.
>
>Ken

-- 
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200803/1

0
ruralguy
3/11/2008 4:00:02 PM
I do.  In the AfterUpdate event I have the following. — Ken

Private Sub cboEvents_AfterUpdate()
    'Populate the listbox with the names of the particpants of the selected 
event.
    Dim intEventSelected As Integer
    Dim strEventDescription As String
    Dim intContactID As Integer
    Dim strFirstName As String
    Dim strLastName As String
    Dim strFullName As String
    Dim rst As DAO.Recordset
    
    intEventSelected = Me.cboEvents.Column(0)
    strEventDescription = Me.cboEvents.Column(2)
    Me.txtEventDescription.Value = strEventDescription
    
   'Clear any records from previous event selection
    Me.lstRecordedParticpants.RowSource = ""
    
    Set rst = CurrentDb.OpenRecordset("tblEventParticipants")
    With rst
        .MoveFirst
        Do Until .EOF
            If .Fields("EventID") = intEventSelected Then
                intContactID = .Fields("ContactID").Value
                strFullName = fncGetContactName(intContactID)
                Me.lstRecordedParticpants.AddItem (strFullName)
             End If
            .MoveNext
        Loop
    End With
    Set rst = Nothing

End Sub



"ruralguy via AccessMonster.com" wrote:

> Do you have any event code in the ComboBox?
> 
> Ken Warthen wrote:
> >I have an Access 2007 form that contains a combobox for selecting events, two 
> >listboxes, one with the names of contacts registered for the event selected 
> >in the combobox, the other with a list of all contacts.  I have two command 
> >buttons; one to add a selected contact to the list of registrants for the 
> >event, the other to remove a contact from the list of registrants.  Both of 
> >the command buttons work, but after either adding a contact or removing a 
> >contact the listbox of registrants will not refresh without me manually 
> >selecting the event again from the combobox.  I have tried using Refresh and 
> >Requery, but can't seem to figure out how to get this to work.  Any help will 
> >be greatly appreciated.
> >
> >Ken
> 
> -- 
> RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
> Please post back to this forum so all may benefit.
> 
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200803/1
> 
> 
0
Utf
3/11/2008 5:23:02 PM
I have tried that without success.

"Klatuu" wrote:

> Requery the list box in the Click event of the command button, after  you 
> have added or removed the entry.
> -- 
> Dave Hargis, Microsoft Access MVP
> 
> 
> "Ken Warthen" wrote:
> 
> > I have an Access 2007 form that contains a combobox for selecting events, two 
> > listboxes, one with the names of contacts registered for the event selected 
> > in the combobox, the other with a list of all contacts.  I have two command 
> > buttons; one to add a selected contact to the list of registrants for the 
> > event, the other to remove a contact from the list of registrants.  Both of 
> > the command buttons work, but after either adding a contact or removing a 
> > contact the listbox of registrants will not refresh without me manually 
> > selecting the event again from the combobox.  I have tried using Refresh and 
> > Requery, but can't seem to figure out how to get this to work.  Any help will 
> > be greatly appreciated.
> > 
> > Ken
0
Utf
3/11/2008 5:24:00 PM
How about just giving the lstRecordedParticpants ListBox a RecordSource that
lists what you want rather than using the .AddItem method of the ListBox.
Then it would probably update on it's own or at least a Requery would work.
Right now it looks like only your ComboBox knows how to fill in the ListBox.

Ken Warthen wrote:
>I do.  In the AfterUpdate event I have the following. — Ken
>
>Private Sub cboEvents_AfterUpdate()
>    'Populate the listbox with the names of the particpants of the selected 
>event.
>    Dim intEventSelected As Integer
>    Dim strEventDescription As String
>    Dim intContactID As Integer
>    Dim strFirstName As String
>    Dim strLastName As String
>    Dim strFullName As String
>    Dim rst As DAO.Recordset
>    
>    intEventSelected = Me.cboEvents.Column(0)
>    strEventDescription = Me.cboEvents.Column(2)
>    Me.txtEventDescription.Value = strEventDescription
>    
>   'Clear any records from previous event selection
>    Me.lstRecordedParticpants.RowSource = ""
>    
>    Set rst = CurrentDb.OpenRecordset("tblEventParticipants")
>    With rst
>        .MoveFirst
>        Do Until .EOF
>            If .Fields("EventID") = intEventSelected Then
>                intContactID = .Fields("ContactID").Value
>                strFullName = fncGetContactName(intContactID)
>                Me.lstRecordedParticpants.AddItem (strFullName)
>             End If
>            .MoveNext
>        Loop
>    End With
>    Set rst = Nothing
>
>End Sub
>
>> Do you have any event code in the ComboBox?
>> 
>[quoted text clipped - 10 lines]
>> >
>> >Ken

-- 
RuralGuy (RG for short) aka Allan Bunch MS Access MVP - acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via http://www.accessmonster.com

0
ruralguy
3/11/2008 6:46:10 PM
Reply:

Similar Artilces:

outlook 2010 sync issues
I am trying the technical preview of outlook 2010. I installed outlook connector to outlook 2010 to use my hotmail account. however, Whenever I command a "send and receive" sync log messages arrive to the syn issues folder. Everyday I get about 50 messages like that. What could be the problem? I don't use exchange or anything like that.... "minimus" <minimus@live.co.uk> wrote in message news:h6dlh5$do0$1@news.eternal-september.org... > I am trying the technical preview of outlook 2010. > > I installed outlook connector to outlook 2010 to use my...

Strange tabbed dialog message pump issue
I am running into a nasty issue that I don't quite understand. My application has a tabbed dialog type control (Stingray Tab-Wnd control) contained in a CFormView object. Within some of the tabs are CDialog-derived windows containing a grid control. I initialize all tab windows when the form view opens. The grid control also has an OnInitialUpdate method that gets called. When a tab is clicked, if it's the first time, a call is made to the tab to fill the grid. After the CFormView initialization is complete I active the first tab programatically and it fills it's gri...

Tax exempt issues..plz help
hey there kind of stuck..I have a client and she needs to use the indian status tax exemption. I have it set up that when everything is done that she can select the HST tax or the Tax Exempt (meaning pay only PST) i believe..anyways When we do this for some reason it goes to $0 in tax which isnt correct..I tried it like 5 times and all same thing..i rechecked everything and i know i am doing it correctly because i ave done it other clients..this one has become a mystery..plz anyone help me asap thanks There is a possable work a round for RMS. You can setup Tax base...

Charts appear snowy (e.g., tv) unless clicked on. Memory issue?
Working with a very large workbook, and charts on the page appear snowy (like a tv on the wrong channel). When I click on the chart however, the snow disappears and the chart becomes visible. Is this a memory issue? Any quick fixes? Thanks Hi, If your chartobject appears as a gray box until selected then try then menu Tools > Options. On the View Tab make sure Show All in the Objects section is selected. Cheers Andy Vlookup help wrote: > Working with a very large workbook, and charts on the page appear snowy (like > a tv on the wrong channel). When I click on the chart ...

Virtual Memory Issues #2
I'm new to managing a server so please have patience with me. I have started receiving a pop up messages on my Server 2003 stating...."Application popup: Windows - Virtual Memory Minimum Too Low : Your system is low on virtual memory. Windows is increasing the size of your virtual memory paging file." The VM size on drive C is set 2046 - 4092 with no VM size set in drive D...so this setting is for both drives. Do you think the VM error I'm getting will be alleviated if I set a paging size for D drive? Thanks for your help On 27 Jul 2006 05:47:47 -0700, "kamor56&qu...

Sales Tax Issue with Dynamics RMS
Here in California, the sales tax recently increase from 8.25% to 9.25%. I made this appropriate changes to the sales tax settings in RMS. The issue is when I get a return for items purchased prior to the sales tax change, the customer is credited at the current sales tax rate of 9.25% rather than the 8.25% that they should be credited. I need to be able to adjust the sales tax percentage at the POS for these returns so that the sales tax amount is correct. Any suggestions? Paul: How about setting up an "Old Tax" code at 8.25% and using Shift-F12 to select and apply the old tax...

Excel issue (Office XP Pro)
One of my clients has an annoying problem every time she starts Excel. The Windows installer screen flashes and it says "preparing to install" This Window stays on the screen for about 5 seconds and then goes away. The program works fine after that. This only happens with Excel and no other Office application. I have done a re-install of Office as well as a Windows repair, but the problem still exists. Any help regarding this matter would be greatly appreciated. Mike Gallof Hi see: http://support.microsoft.com/default.aspx?scid=kb;en-us;265194 -- Regards Frank Kabel Frank...

language issues outlook calendar
Hello, I've run today into two quite interesting issues. Users of OL2K3 are having the wrong language version in their calendar folder. For one user an upgrade from French to Spanish has taken place and now she has a French PLUS a Spanish calendar. Also I have a user who has simply Dutch instead of French. Do you have any idea where I can change the language settings in Outlook clients? Thanks for your comments. Sandor Teglasy Start Outlook with /resetfoldernames. Then transfer the data to a singular folder and remove the other one. -- Robert Sparnaaij [MVP-Outlook] www.howto-o...

Rules issue
I've got a user at my company running Outlook 2007 SP2 (Exchange connection.) In her profile are two mailboxes; her own personal one, and a utility account she often uses for certain correspondences. She has full rights to the utility account (including SEND AS) and frequently sends messages with that account in the FROM field. The problem is that she wants messages that are sent with the utility account in the FROM field to go into the SENT items folder in the utility mailbox. Currently they go into her own SENT items folder which can be confusing. She doesn't want ...

John O'Donnell: Regarding to SFO Offline issue
Sorry I cannot reply my latest message regarding to SFO offline issue. My Case is i can offline and download CRM data to my MSDE successfully, but i cannot list out any object. On the other hand, i can create Lead, Opp... So strange case..... Anyway, Thanks for your previous reply. if you click on the accounts when offline what message do you get? -- John O'Donnell Microsoft CRM MVP http://www.microsoft.com/BusinessSolutions/Community/CRMFaqLanding.aspx "new guy in MSCRM" <fsfli@hellokitty.com> wrote in message news:3388ad66.0412201933.26fa0abe@posting.google.com.....

Exchange issue with browsing accross IP Sec tunnel
I support a remote site lets call it site B. At site B we use sonicwall IP Sec tunnels to connect 25 or so pcs and 3 servers (2 of which are 2000 DC's), to site A. The client machines and servers use this tunnel from a Site B (192.168.44.0) to connect Site A (192.168.1.0) which contains additional DC's and our primary and only exchange server. Up until about a month ago everything worked fine between the sites and we could replicate DNS etc client pcs could browse files on both sides using unc names or unc ip mappings. Then it basically stopped working, our tunnel is up and ...

Data import issue from Access
Carriage return (Ctrl+Return) in access data in one cell is imported to "I" into the place of carriage return. Some one have magic idea to import same as excel? Access source data I hope this work A) It should work this way After import to Excel I hope this work | A) It should work this way ...

Displaying listbox selection in textbox
I av a problem trying to create a macro that the selection made in listbox(List1) to be displayed in a textbox(Text1). here is the code that i did so far but i cant get it to work: Sub Expense_Select() 'Link the data to the listbox Range("G7:G18").Select ActiveSheet.Shapes("List1").Select With Selection .ListFillRange = "$G$7:$G$19" .LinkedCell = "" .MultiSelect = xlNone .Display3DShading = False End With End Sub Private Sub List1_Click() 'display the selected item in the textbox Text1.Text = List1.List(List1.ListIndex) End Sub ANY sugg...

Outlook and SBS 2008 issues
I have a user that has a 2.8gb mailbox on an SBS 2008 server. I've set the user mailbox limit to 30GB and the default in Exchange is set at 19GB, but the account comes up and says mailbox is full. Where do I start looking? "Vince" <vinceqb@gmail.com> wrote in message news:e6013561-3667-4ee8-a56f-8d9f732fe661@t9g2000prh.googlegroups.com... >I have a user that has a 2.8gb mailbox on an SBS 2008 server. I've > set the user mailbox limit to 30GB and the default in Exchange is set > at 19GB, but the account comes up and says mailbox is full. Where do...

For Next issue with repeated procedure
I have the procedure below. Basically I don't want to have interminable lines of code when all I am doing is repeating the same procedure on a differnet range. How can I write the procedure that it loops through the procedure with the 6 different ranges rng1 = "A1:A9" rng2 = "A11:A20" Rng3 = "A30:A34" Rng4 = "A40:A48" Rng5 = "A50:A59" Rng6 = "A65:A69" n = 6 For i = 1 To n ActiveCell.Range(rng(i)).Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues Applicati...

print issue (prints fine but then open the report???)
Hello Guys, I have a form with command buttons set to print the designated reports. I have used the following code as the "On Click" event DoCmd.OpenReport "Unit Mail List", acViewPreview On Error Resume Next DoCmd.RunCommand acCmdPrint Dim strRptName strRptName = "Unit Mail List" DoCmd.SelectObject acReport, strRptName, False The code works fine, it gives me the printer dialog box so the user can select the printer, #copies etc... but once it kicks the report to the printer it opens the designated report??? How can I just have the code prompt the user fo...

I need to issue a credit
I have a company that I bill that sends me a check to deposit and then work off. It is like a retainer. I am not sure how to get the amount of the money into their account and then how to make it show on the invoice. Anyone had any experience with this type set up? ...

Exchange 2007 send e-mail issue
Hello all, I recently migrated to exchange 2007 with an edge transport server. The old Exchange 2003 server is still up as well. the 4 test users that were put on the new box can send e-mail within the domain but not to recipient outside the domain. the users on the 03 server can send to both inside and out side addresses. The send connectors appear correct from when I subscribed the edge transport server to the domain. I would appreciate any help I can get. thanks in advance, cowen ...

Exchange 2010 issue
Hi All, Had the weirdest problem with Exchange 2010. Today, one of my customers had outlook disconnecting and reconnecting every minute or so. This was happening on every machine. Looking on the server there didn't seem to be any problems. it was dropping my RDP connection as well however. This machine is running on vmware so I thought this might be a problem. I rebooted the vm. Upon rebooting, the machine hung at "applying computer settings". I shut the machine down and disabled the network adapter. Doing this allowed the computer to boot. Viewing the event log, ther...

Various Outlook 2003 issues
Hello, I've been using OL2003 w/ WinXP since it was released. I used various other versions of OL for many years before that. In all that time, I have never experienced the issues that have come up lately. I'm hoping someone can help me resolve them. 1. In the midst of composing a new message or replying to a message, the message format will change from HTML to plain text all by itself. This started happening with replies to one person specifically but has happened with increasing frequency and probably occurs with more than 50% of all ougtoing messages now. When I switch the message...

Pivot issue #2
Greetings everyone, I am just not able to get the pivot to give me % of column subtotals When I do it with one variable I get the right numbers like this : 2007 2008 2009 A John 80% 75% 60% Pat 20% 25% 40% Now when I add another variable B I get it as 2007 2008 2009 A John 20% 20% 15% Pat 20% 30% 20% B Emily 30% 30% 30% Jane 30% 20% 35% I would like to have A and B to have their own percentages and not the percentage of the entire column. Would really appreciate if any one could point out where I am missing out or bluntly help me get over this :) basically like this 2007 200...

CRM 3.0 Performance Issues on SBS 2003
Anyone have any idea why CRM takes minutes to launch the first time it is executed on a client computer via the web client or the V3c Outlook Desktop client with HFR2? Here is a note from my customer: I just attached to CRM for the first time today via the browser. It took about 1 minute before it would respond and populate the screen with data. I didn’t get any errors but this seems excessively long. Once the initial data is populated it seems pretty peppy again. Can you check this out? Does it do something very intensive the first time it is accessed each day? Is it only once p...

Issue with OWA compose and replies...
On a couple of clients in our Outlook 2003 environment, using OWA allows people to read messages, but replying or composing a new message results in the textarea where the body of the message is to be typed, shows only a broken link red X. One is on Windows XP SP1, the other SP2. On the SP2 clients, I have run SFC, reinstalled SP2, repaired, and then removed office 2k3, removed and reinstalled Java (Sun's 1.4.2_5). In IE 6, this is a problem, also have the same problem with creating a signature for use in OWA. In Firefox, there's no problem, it works fine, but IE 6 it's no go. This...

printing issues
Version: v.X Operating System: Mac OS X 10.5 (Leopard) Processor: Power PC Files created in Office v.X on my G5 print fine (word, excel and PPT) to all three printers in my office. One USB printer and two networked. Also, files created on other Macs and PCs and emailed to me printed fine. Recently, any emailed office files sent to me will not print. These range from office 2008 Mac to PC office files. These were printing fine but now won't print at all. After clicking on print, the progress bar speeds across the screen and then nothing. I checked Page setup, printer selection in print di...

Valid user cannot be resolved issue
Hi, I am using below code to resolve the "userName". It works absolutely fine for 99% users but cannot resolve some of our users. Could anyone please suggest what could be wrong? I am not sure but it has to do something with their stored Outlook information? Set rcp = Application.Session.CreateRecipient(userName) rcp.Resolve If NOT rcp.Resolved = True Then MsgBox "User " & """" & userName & """ could not be resolved." End If While researching on this issue, I ran into below scenario that might be th...