UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> List box only updates first time    
 
   
ElAmericano
post Oct 6 2007, 12:48 PM
Post #1

UtterAccess Enthusiast
Posts: 56
From: Alcalá de Henares, Spain (Near Madrid)



I have a form with several subforms. One of the subforms is for addresses. One of the subforms is for invoice data. The invoice data includes a drop down list in order to select one of the addresses in the adress subform.

At first I had to open and close my main form in order to get the list to update. Then I read about "Me.dropdownlist.Requery"

First I tried adding the code as an "AfterUpdate" command to the address subform but that didn't work, probably because I have the list on another subform.

So I tried adding this code directly as an "On Click" event of the actual drop down list. This works......sort of.

The first new address that I add to the form gets updated in the list but each address after the first one doesn't.

Why am I getting a result only on the first new address that I add?

Thank you for any light you can shed on the problem.

El Americano
Attached File(s)
Attached File  v1.4_utter2.zip ( 112.84K ) Number of downloads: 1
 
Go to the top of the page
 
+
ubergud
post Oct 6 2007, 05:10 PM
Post #2

New Member
Posts: 10



You can put the code on on the AddressListBox_AfterUpdate() Event to requery the other subform, the key is how you reference it. I cannot recall the syntax off the top of my head (there was something different about it), but you should find something like this:

CODE
Private Sub AddressListBoxOnAddressSubForm_AfterUpdate()
  Dim MainForm As Form
  Dim InvoiceSubForm As Form
  Set MainForm = Me.Parent
  Set InvoiceSubForm = MainForm!OtherSubForm
  InvoiceSubForm.AddressListBoxOnInvoiceSubForm.Requery
End Sub


I believe there should be a help topic on how to reference a control on a SubForm, which should lead you toward the syntax you are looking for.
Go to the top of the page
 
+
theDBguy
post Oct 6 2007, 09:33 PM
Post #3

Access Wiki and Forums Moderator
Posts: 47,955
From: SoCal, USA



Here's a link to The Access Web. HTH.
Go to the top of the page
 
+
ElAmericano
post Oct 7 2007, 12:30 PM
Post #4

UtterAccess Enthusiast
Posts: 56
From: Alcalá de Henares, Spain (Near Madrid)



I've tried requerying the list box from the address subform with the information on "The Access Web" but I'm still only getting an update with the first new address that I add. Each address after the first address doesn't get updated.

This of course is better than no updates at all, but I can't figure out why it doesn't requery every time I add a new address.
Go to the top of the page
 
+
theDBguy
post Oct 7 2007, 01:12 PM
Post #5

Access Wiki and Forums Moderator
Posts: 47,955
From: SoCal, USA



Can you convert your db into 2003, so I can take a look at it? Thanks.
Go to the top of the page
 
+
ElAmericano
post Oct 7 2007, 02:15 PM
Post #6

UtterAccess Enthusiast
Posts: 56
From: Alcalá de Henares, Spain (Near Madrid)



Ok, I got it, but just in case there's a better way, here is 2003 version of the databse. Everything is built off of the "mainform"

In the end, i've used the following code on the dropdownlist i've named "invoiceaddr" as en "On Click" event: invoiceaddr.requery

The reason that my list only updated with the first address that I added but not with consecutive addresses, is that I needed a refresh which I've added to the after_update of the address_type subform.

Thanks for the pointers.
Attached File(s)
Attached File  v1.4_utter3.zip ( 92.17K ) Number of downloads: 0
 
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 21st May 2013 - 03:26 PM