PDA

View Full Version : To have a report prompt you for what values you want



dave
08-23-2006, 10:49 AM
Open up your report, right click in the grey area and select, "build event" / "code"

Paste this in:

Private Sub Report_Open(Cancel As Integer)
DoCmd.ApplyFilter , "fieldName like ENTER_TAG_NUMBER and fieldName like Enter_Line_Number and fieldName like enter_pid_number and
not like Enter_Filter"
End Sub

*replace fieldName with the real fields name or alias

my question is if I want the report to ask me what I DON'T want to see, I put this:

"and
not like Enter_Filter"

meaning:
(promts me for field name) and Enter_Field (prompts me for the value)in any case, it didn't work. Anyone know the proper syntax for that?

Also, it would be cool to be able to "sort" by a criteria.

PlantWorker
08-23-2006, 12:41 PM
Dave,

i don't know how to build such a filter in the repots, but there might be a better solution : do you know you can also build MSaccess forms in Data Manager ?
In there you can build whatever you want to create the list you need and transfer that to a report.
We use it to send data in a certain format to xls. i don't know all the details since it was configured by a bentley consultant.

to activate the forms, modify at.ini as follows :

[DataManager]
REGAPP=DMGR
USERFORMS=1

(on ALL machines)

dave
08-23-2006, 01:11 PM
Yeah I've seen that feature before PW and posted it HERE (http://www.davetyner.com/forum/data-manager/t-forms-in-data-manager-56.html/?highlight=forms), I could never make it work though. I don't suppose you could post the VB code on that?

As far as this report criteria goes, another problem I have having is that when I enter a value of * it won't pick up the blanks. IE: the entire cow may not contain blanks or else it won't show anything. Is there an access VBA code to tell it "I want to see blanks too"?

Data Wrangler
08-24-2006, 05:25 AM
Is there an access VBA code to tell it "I want to see blanks too"?

The Nz() function may be what you are looking for.

Derek

dave
08-24-2006, 10:28 PM
The Nz() function may be what you are looking for.
Yes, the functionality of that function is what I need, I tried a number of methods to run it in my report to no avail. I modified a view and added an alias field that read something like this:
http://www.techonthenet.com/access/functions/advanced/images/nz001.pnghttp://www.techonthenet.com/access/functions/advanced/images/nz001.pnghttp://www.techonthenet.com/access/functions/advanced/images/nz001.png

that ran ok for that aliased field but left the real field blank. Here is a snippet I found from http://www.techonthenet.com/access/functions/advanced/nz.php

Dim LOption As String
LOption = Nz(varChoice, "Not Found")
Do you know where or how to insert that code into the code below?

Private Sub Report_Open(Cancel As Integer)
DoCmd.ApplyFilter , "fieldName like ENTER_TAG_NUMBER and fieldName like Enter_Line_Number and fieldName like enter_pid_number and
not like Enter_Filter"
End Sub

Thanks!

Data Wrangler
08-25-2006, 05:40 AM
Ideally you want to use the filter after you've set up the query/view to get the information you want. I don't really use filters in that way (on open) - the only time I use filters is to isolate something in "real time" when I'm working with a query/view. Using nz() is easy when you are setting up a query - you could set up a form to ask for your variables, then create the query from that.

Unfortunately, I'm going to be offline for a week - I'm moving from PA to TN, so I'm not going to be reading any replies. I expect you guys to have it all figured out by the time I get back...

Derek

dave
08-31-2006, 07:12 AM
Dave,

i don't know how to build such a filter in the repots, but there might be a better solution : do you know you can also build MSaccess forms in Data Manager ?
In there you can build whatever you want to create the list you need and transfer that to a report.
We use it to send data in a certain format to xls. i don't know all the details since it was configured by a bentley consultant.

to activate the forms, modify at.ini as follows :

[DataManager]
REGAPP=DMGR
USERFORMS=1

(on ALL machines)

Any chance you could post the source code of that form PlantWorker?

PlantWorker
08-31-2006, 12:26 PM
Dave,

I'll build a sample of what we have in a bentley 'base' project. I cannot give you the code from the real project since we payed a Bentley consultant for it.
My company is very strict about this ...
It's no problem with the things we get for free from Bentley, but this is more sensitive


Expect it somewhere next week.

dave
08-31-2006, 01:06 PM
Thanks a-lot Plantworker

PlantWorker
09-06-2006, 01:19 PM
Dave,

I have a sample project with a form for the equipment list. You can filter and sort the list with standard MSaccess functions. At the bottom of the form a button calls the report in preview mode, with the filter and sorting applied to it.From the preview, it can be printed

The zipped project is a bit too big to attach here, you can get it at

HERE (http://www.davetyner.com/peterj/reportingtools.zip)

(just unzip it, it's an msaccess project, it's not a package)

I got this sample from my contact at Bentley (I got lost at retreiving the code from our own projects, since it has more stuff in it), He said this code might get included in future administrator-training.

dave
09-07-2006, 12:27 AM
Terrific! I can't wait to try this out tommorrow. Thanks Plantworker. I moved the file to your ftp space on my site (remember I gave you 250 MB's ;) ) Get the file HERE (http://www.davetyner.com/plantworker/reportingtools.zip)

PlantWorker
09-07-2006, 01:33 PM
Dave, I'm not aware about the 250 Mb ftp; How Do i access it ?

dave
09-07-2006, 02:05 PM
check your private messages ;)

PlantWorker
09-08-2006, 10:58 AM
didn't know about that ....
nice though.

But how do I fill 250 MB ?????

dave
09-11-2006, 07:18 AM
Well, you don't have to do it today but it's there for stuff like this ;)

dave
01-21-2007, 02:01 AM
any chance of reposting this project plantworker?

dave
01-21-2007, 11:01 PM
Well trying to make a pop-up form inside of DM, nice if you want to pull your hair out or curse uncontrollably. Working inside the .adp however is golden. For our part, we've just gained major efficiency on lists working inside the adp.

cbrock01
03-17-2008, 03:44 PM
Dave,
Anyway you can repost the file. None of the links are good now.

...Thanks

dave
03-18-2008, 07:50 AM
Carl, I will try and locate the file. Please update your email address in your profile and check your private messages B)

dave
03-19-2008, 03:29 PM
Carl, the link has been restored.