By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,694 Members | 2,121 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,694 IT Pros & Developers. It's quick & easy.

Not recognizing multiple conditional actions within Macro - Help, please

P: n/a
Hello all...I'm a bit new to working with Macros in Access so forgive
me if the terminology I use is not accurate.

To preface this, basically I am using a form on a replicated database
so the end-user can filter on a specific report they want to see. This
database was designed by my predecessor (of which he left no
documentation) and I need to add some additional functions to this
end-user filter report.

Within one Macro, he has over 30 conditional actions. I have since
added an additional attribute to the database (public
comment/non-public comment). I want to make this an option when
filtering reports. I've added about 5 new conditional actions that
incorporate this and they worked (including the original 30 conditional
actions within the same macro). After I add the sixth conditional
action, the new action works, but then most actions underneath it do
not work (there are no error messages...it just doesn't recognize the
filter constraints).

My question --- could it be the order in which I add these actions? Or
could it be a limitation of Access?

Thank you --- any help would be greatly appreciated. This has been
driving me nuts all weekend. If you think you might be able to help
and need additional info or examples, please let me know and I'll get
them ready. Thank you!!!!

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Sorry, but this is probably at best an indirect answer to your
question. I almost never use macros, so don't know a whole lot about
them. That said, almost anything you do in a macro, you can do with
VBA, and usually do it better.

If you wanted to, you could convert the macro you have to VBA
(Right-click on the macro, choose Save As, and then choose Module.
Then you can simplify the insane number of this kind of thing:

If Forms![MyForm]![MyField]=1 Then
'Do one thing
End If

If Forms![MyForm]![MyField]=1 Then
'Do another thing
End If

to something like

Select Case Forms![MyForm]![MyField]
Case 1
'do one thing
Case 2
' do another thing
....
Case Else
' do the default thing
End Select

Also, you can build your filters incrementally, by testing a control to
see if it has a value, and if it does, add it to the filter...

If not IsNull(Forms![MyForm]![MyControl]) then
strFilter = strFilter & "[TableName].[FieldName]=
Forms![MyForm]![MyControl]
End if

it just makes building the filters a lot easier. And then at the end
you can just pass the filter you've created with your function to the
open event of your report in the DoCmd.OpenReport method...

Hope I haven't totally lost you. You might want to look up the
OpenReport method in the helpfile...

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.