atw: Re: Persistent Data in Userform List box

Did you cut n paste this code? ..cause if you did then what is a Wixard ?

> -----Original Message-----
> From: austechwriter-bounce@xxxxxxxxxxxxx [mailto:austechwriter-
> bounce@xxxxxxxxxxxxx] On Behalf Of Lucas Simpson
> Sent: Friday, 19 May 2006 1:49 PM
> To: austechwriter@xxxxxxxxxxxxx
> Subject: atw: Persistent Data in Userform List box
> 
> Howdy Listies
> 
> Just can't seem to solve this so hoping someone can point out my
> stupidity.
> 
> Basic Scenario:
> 1. Have Form 1 with List box
> 2. Click Add button on Form 1 to load Form 2 and sync a list box on Form 2
> with same list items as in Form 1 list box.
> 3. After Editing list, click OK on Form 2 to pass Form 2 list items back
> to Form 1 list box.
> - Have multiple list boxes on Form 1 (with a concommittant Add button)
> that all use the same Form 2 for editing as per 1 to 3 above.
> 
> Code works no problem, can pass back and forth between Form 1 and Form 2
> listboxes.
> 
> Problem is:
> 1. Add list values using above method to first listbox on Form 1. So far
> so good.
> 2. Add list values using above method to second listbox on Form 1. So far
> so good.
> 3. Attempt to re-edit first listbox on Form 1 and the values from the
> second listbox on Form 1 still appear in Form 2 listbox. Not good.
> 4. Cancel Form 2 (which unloads form) and then attempt step 3 again. Now
> the correct list values (ie. from first listbox on Form 1) load into Form
> 2 listbox.
> 
> This suggests to me that Form 2 is not correctly unloading after passing
> values back to Form 1 (on click OK). But buggered if i know why as Form 2
> is instructed to unload on the OK click event, just as it is on the Cancel
> click event.
> 
> Sure would appreciate someone giving me a clue.
> 
> OR Is there a better way for me to inform Form 2 about which list box in
> Form 1 i am referring to. Can't seem to just pass the relevant Form 1 list
> box object directly to the Form 2 Userform_Initialize sub.
> 
> 
> Hope this makes sense.
> 
> Cheers
> Lucas
> 
> 
> Here is the code:
> 
> ''++++++++++Form 1 (frmWizard)++++++++++
> 'Private Sub cmbSecurity1_1_Click()
> 
>     ''lstSecurityRequirement is Public Variable dim'd as Object used to
> pass to Form 2 which listbox on Form 1 i am referring to
>     ''lstFacilitySecurity0 is actual list name in Form 1
>    Set frmWizard.lstSecurityRequirement = frmWizard.lstFacilitySecurity0
> 
>     frmSecurityEdit.Show  'Display Security Edit dialog
>     frmSecurityEdit.lstAllSecurityValues.List =
> frmWizard.lstSecurityRequirement.List 'Sync lists
> 'End Sub
> 
> 'Private Sub cmbSecurity1_2_Click()
> 
>    ''lstSecurityRequirement is Public Variable dim'd as Object used to
> pass to Form 2 which listbox on Form 1 i am referring to
>     ''lstFacilitySecurity1 is actual list name in Form 1
>    Set frmWixard.lstSecurityRequirement = frmWizard.lstFacilitySecurity1
> 
>     frmSecurityEdit.Show  'Display Security Edit dialog
>     frmSecurityEdit.lstAllSecurityValues.List =
> frmWizard.lstSecurityRequirement.List 'Sync lists
> 'End Sub
> 
> 
> '++++++++++Form 2 (frmSecurityEdit)+++++++++++
> 'Sub UserForm_Initialize()
> ''No code
> 'End Sub
> 
> 'Private Sub cmdOK_Click()
> 
>     'Synchronise Security list values with Edit List Values
>     frmWizard.lstSecurityRequirement.List =
> frmSecurityEdit.lstAllSecurityValues.List
> 
>     frmSecurityEdit.Hide
>     Unload frmSecurityEdit
> 'End Sub
> 
> 
> 'Private Sub cmdCancel_Click()
>     frmSecurityEdit.Hide
>     Unload frmSecurityEdit
> 'End Sub

**************************************************
To post a message to austechwriter, send the message to 
austechwriter@xxxxxxxxxxxxxx

To subscribe to austechwriter, send a message to 
austechwriter-request@xxxxxxxxxxxxx with "subscribe" in the Subject field.

To unsubscribe, send a message to austechwriter-request@xxxxxxxxxxxxx with 
"unsubscribe" in the Subject field.

To search the austechwriter archives, go to 
www.freelists.org/archives/austechwriter

To contact the list administrator, send a message to 
austechwriter-admins@xxxxxxxxxxxxx
**************************************************

Other related posts: