473,322 Members | 1,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Not recognizing multiple conditional actions within Macro - Help, please

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
1 2263
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Matt | last post by:
The ASP page has multiple buttons, and when the user clicks different buttons, it will submit the form data to different URLs. My first approach was to use BUTTON type, and triggers javascript...
13
by: Andrew | last post by:
I use conditional compiler constants, set through the VBA IDE in Tools, <projectname> Properties, that I refer to throughout my code to control which code is used during development, and which...
3
by: Diana Gard | last post by:
Perhaps this is a design flaw, please let me know. I'm using Access 2000. I have a form with a tab control and 5 subforms within those tabs. The forms match with the tables: Client main,...
0
by: MHenry | last post by:
Hi, I know virtually nothing about creating Macros in Access. I would appreciate some help in creating a Macro or Macros that automatically run(s) 14 Queries (three Make Table Queries, and 11...
28
by: richardlang | last post by:
Anyone out there ever come across a preprocessor macro that compares an argument value against the predefined __DATE__ macro in order to control conditional compilation based on date. Something...
11
by: junky_fellow | last post by:
Hi guys, I have a piece of code: int func(int flag) { int number=1; if (flag == 1) return 0; if(flag == 2)
12
by: code break | last post by:
Hi all, Please can any one tell me the importance of below code... #if 0 /*what is use of this macro conditional.since this is every time false .*/ stmt1 ; #else
4
by: apartain | last post by:
I have a macro with several actions in it. They each have a condition. The macro seems to be working for the first line of action, but not for any of the subsequent actions. Any ideas why this may...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.