This code has been working fine until now??

Darren Smith

Well-known Member
Joined
Nov 23, 2020
Messages
631
Office Version
  1. 2019
Platform
  1. Windows
Morning All

This Toggle Switch code has been working fine until now.
Now the error message says
Run-time error 401
Can`t show non-modal form when modal form is displayed
How do I overcome this

VBA Code:
Private Sub Parts_Form_Click()


If Me.Parts_Form.Value = True Then

Jobcard_Parts.Show False

        Me.Width = 225
        Me.Height = 60
        Me.Parts_Form.Top = 0
        Me.Parts_Form.Left = 0
        Me.Parts_Form.Caption = "Close Parts Form"
        Me.Top = 700
        Me.Left = 0
Else

Jobcard_Parts.Hide

Body_And_Vehicle_Type_Form.Show False

        Me.Width = 1013
        Me.Height = 630
        Me.Parts_Form.Top = 450
        Me.Parts_Form.Left = 10
        Me.Parts_Form.Caption = "Open Parts Form"
        Me.Top = 0
        Me.Left = 300
End If

End Sub
 
Sorry forms are to big the have frames
The code below opens the Job Cards Parts Form.
But it will not hide Body and Vehicle Type form?
And then I can`t hide the Jobcard Parts Form then show Body And Vehicle Type Form?
It gets to this part of the code then jumps over the rest

VBA Code:
Jobcard_Parts.Show

Private Sub Parts_Form_Click()


If Me.Parts_Form.Value = True Then

Me.Parts_Form.Caption = "Close Parts Form"

Jobcard_Parts.Show

        Me.Width = 225
        Me.Height = 60
        Me.Parts_Form.Top = 0
        Me.Parts_Form.Left = 0
        Me.Top = 700
        Me.Left = 0
      
Else

Jobcard_Parts.Hide

Me.Parts_Form.Caption = "Open Parts Form"

Body_And_Vehicle_Type_Form.Show

        Me.Width = 1013
        Me.Height = 630
        Me.Parts_Form.Top = 450
        Me.Parts_Form.Left = 10
        Me.Top = 0
        Me.Left = 300
End If

End Sub
 
Last edited:
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
consider workarounds. eg use a multipage and switch between groups if items.
i actually built a whole system for a motor mechanic. you will never get all the service options on 1 page. i used a multipage and split jobs into sections. eg heavy engine, transmissions, general service, suspension, etc, then the parts list becomes specific to the task and you end up with a lot more space.

your clashing userform issue could be caused by something else that you have not considered. i found that nonmodal userforms were prone to glitching, and i avoid using them
 
Upvote 0
Solution
welcome to come back if you need some assistance. that plan of attack worked for me. cheers
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

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