|
-
Jul 24th, 2008, 04:20 AM
#1
Thread Starter
Junior Member
Syntax help - cleaning up my code
I currently have some VBA code which consists of a series of IF statements that receive the choice from an input box and use this choice to filter a report so that only the appropriate report entries are displayed.
What I am looking to do now is just make my code more manageable for future users, for at the moment there are quite a lot of these IF statements across various forms.
Basically what I want to do is go from this:
IF DropBoxChoice = "Choice" THEN
DoCmd.OpenReport ReportDocName, acPreview,, Fieldname Like '*Choice*'" (plus a few other filters)
END IF
Many many times...
To something more like this (obviously this doesnt work)
DoCmd.OpenReport ReportDocName, acPreview, Fieldname Like DropBoxChoice
i.e. cutting out loads of IF statements and making the coding practice much cleaner!
Obviously this is not a vital change, the system runs fine. It will just be useful to future users to not have to cope with a gzillion lines of code.
Thanks very much for any suggestions on how to I can go about tidying up this code
Cheers
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|