PDA

View Full Version : Solved: Load AND unload?



russkie
01-19-2006, 01:23 PM
Hey,

I have userform, in one text box you when your entering new product information is a barcode slot, while punching in the barcode (or when your down with it) the box searches database to find any copies, so you know immediately when entering the barcode whether the product already exists or another one has the same barcode.

What i want to happen is when it finds a matching barcode, a button appears to give you the option to EDIT the copy it found, for the editing there is another userform. Problem is if i do Load EditingForm and Show from this button it will load the other form, cool, but if BOTH of these forms are open it causes problems.

So how can i Unload the NewProductForm and simaultanously (SP?) open the EditingForm?

I tried to have a "midway" userform where when you click on the Edit button that appears from the newproduct form it would open up an empty userform and on that empty one the "_activate()" part would unload the NewProduct and Load the EditingForm, but i get an error saying simply it CANT unload the NewProduct form...

Any Idea?
Thanks.

asingh
01-19-2006, 03:26 PM
Hi,

You could try the following...

Private Sub Click_Show_EditForm ()
'this is the button where the new form is to be launched from

NewProductForm.Hide
Unload NewProductForm
Set NewProductForm = Nothing

Load EditForm
EditForm.Show


End Sub

what this will do....completely KILL the instance of the NewProductForm and display the editform. If you dont want the instance to be KILLED then dont use Unload & Set NewProduct = Nothing. If you want the NewProductForm to be displayed again..then another command button will be required..to unload the edit form..and display the new product form again.




end sub

russkie
01-20-2006, 08:38 AM
perfect, thanks alot!