Show Form Issue

rat_b76

New Member
Joined
Sep 12, 2003
Messages
21
Hi all,

I have been building an Excel Spreadsheet with a number of user forms, everything was working fine - until now.

I will explain:
I have a Main Form (frmMain) which opens a series of other forms.

Every time I click on a command button which opens say the Search Form (frmSearch) it goes into debug mode and highlights the code:
Code:
frmSearch.Show
If I click on the Play button, away it goes as normal until I attempt to complete an action on the Search Form and then it debugs and highlights the same code as above?

I am racking my brain, and as this spreadsheet has taken a fair bit of work, I don't want to abandon it now.

Can any one help....please.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Hi, rat_b76,

open your userform code

hit function key F8 to step through the code
what's highlighted as an error ?

kind regards,
Erik
 
Upvote 0
I ran into a similar problem. The error occurs because the user form is already open. The only solution that I've come up with is to unload the user form when you return to the main menu. However, this causes all your data to be dumped.

Anyone else know another solution. I read something somewhere about about the modal = false, but this did nothing for me.
 
Upvote 0
Hi, Mkammari,

please tell us what your forms are doing
and post the code you're using
(select your code and click "Code"-button above your replybox)
kind regards,
Erik
 
Upvote 0
This is the code to go to the Customer Information Screen from the main menu.

Code:
Private Sub CmdCustinfo_Click()
FrmCust.Show
End Sub

The following is the code To return to the main menu.

Private Sub CmdMain_Click()
Unload Me
FrmMainMenu.Show

What I would like to do return to the main menu without dumping the information in the Customer Info user form.  The only way it works is if I unload the customer info userform.
 
Upvote 0
Instead of Unloading the form, why not Hide it?
 
Upvote 0
Mkammari,

sometimes it's difficult to know what the other tries to explain :confused:
often it's because one thinks it's very simple while the other doesn't see the trees in the wood :)

let's simplify things
userform1 has
textbox1
commanbutton1
Code:
Private Sub CommandButton1_Click()
Me.Hide
UserForm2.Show
End Sub

userform2 has
textbox1
commanbutton1
Code:
Private Sub CommandButton1_Click()
Me.Hide
UserForm1.Show
End Sub
you can freely switch between the forms using the commandbuttons
anything you type in the textboxes remains there

does this shade any light on your situation ?

best regards,
Erik
 
Upvote 0
Eric...I'm sorry for being vague. I'm new to the forum and am basically teaching myself visual basic. I will try your suggestions and I'll try and be more detailed next time. Thank you for your replies and attention.
 
Upvote 0

Forum statistics

Threads
1,214,644
Messages
6,120,709
Members
448,983
Latest member
Joaquim_Baptista

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top