One macro causing another Macro to not finish

Montez659

Well-known Member
Joined
May 4, 2005
Messages
918
Good morning (afternoon, evening) all!

I will try to explain this best I can, and will try to get a snapshot of what I am talking about here in a few after I figure out how to do it.

I have two forms, one a "list" and the other a details. One is essentially in datasheet view and the other individual records. There is a formula in the list so that if a user clicks on the the word "Open" it will apply a filter to the "details" form so that record will show. Clicking on "open" triggers an On Click event. Halfway through the Macro running as the code is called to open the form, the Macro halts to trigger the On Load event of the "details" form. All works well like this even though as I step through the code it seems like the rest of the "On Click" code doesn't trigger.

When it ceases to work properly is if I try to apply a filter to not show Archived records in the On Load event of the details form. If I do the simple code of ApplyFilter, the only thing that happens when the user clicks on "Open" is that it goes to record 1 instead of the correct record.

I will post the code or screenshots of the code here in a few.
 
Montez

What I posted would probably only be part of the code and it might not be applicable to your situation.

Basically it is a toggle - Me.FilterOn is used to either return TRUE/FALSE if the filter is on/off or to set the filter on/off (TRUE/FALSE).

So the code just changes the filter from True to False or False to True depending on it's current state.

Perhaps it's more suited for turning the filter of the current form on/off.

As for clearing the filter I think you do need to use "".

If you turn off the filter then it should have the same effect, and the original filter will still be there to use later.

I actually thought that's what you were doing now, obviously I was wrong.:oops:

PS Here's a little bit of code that might make more sense.
Code:
If Me.FilterOn = True Then
     Me.FilterOn = False
Else
     Me.FilterOn = True
End If
 
Upvote 0

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Good deal! Sometimes I figure out a way to do things that may be more complicated than best practices and go with that because I don't know any better. But as long as you are out there to show me a better way, I will definitely listen. Thanks for all your wisdom and help!
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,834
Members
452,947
Latest member
Gerry_F

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