×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Data Report, how to filter data from Access at runtime

Data Report, how to filter data from Access at runtime

Data Report, how to filter data from Access at runtime

(OP)
Ok, I have gotten to the point in my VB programming where I want to start wasting paper to kill more trees, and the only way I know how to do this is by printing reports.
 
In visual basic there seems to be only 2 ways (without buying add ons).  Either use the printer object, (in which case you have total control and can do whatever) or use Data Reports (which are easy to make nice and pretty but, how do you let the user specify selection parameters at runtime?)
 
Ok so I am using data reports.  The problem is, how am i supposed to allow the user to specify selection parameters at runtime? ( Such as a date range to report). The only thing (short of copying the database and deleting the data i want to filter out) I have been able to figure out is to use a form or inputbox to get parameter values from the user and then modify the contents of
DataEnvironment1.rsCommand1.Source which has a shape definition.  (This does work)
 
I am thinking there must be an easier way.   If you know of an easier way or of cheap active X component I could get for doing reports please let me know.
Replies continue below

Recommended for you

RE: Data Report, how to filter data from Access at runtime

How are you receiving the data from your database? If you are using a recordset to open a table (ADO objects) weith either a connection or command object, you can use SQL to place limitations on the data received (qualifiers and matches on specified fields in the data) so that you will only receive data that matches your query. This has the added bonus of creating less communications if you force the user to hit an "update" button before requesting the data because only the data that matches there requirements is returned to you, rather than the whole table.

If you are using VB directly built into access (I'm not entirely familiar with reporting straight from VBA, most of my clients want excel generated reports) you should look into setting the filter attribute which should allow you to filter the results to the users specifications.

Let me know if I am way off in left field here, and I'll look into it :)

-Tarwn

RE: Data Report, how to filter data from Access at runtime

(OP)
A Data Report uses a data environment object, as the source of its recordset(s).  The data envirnment can use a SQL statment(s) or more database objects each object can be a table, view (stored query), synonym (i dont know what that is), or stored procedure ( i have not messed with those yet)

I tried setting the value of
DataEnvironment1.rsCommand1.Filter
But i get a message saying "1 or more required parameters
is not set." when i do that.

The SQL text does not seem to be a property i can get to at runtime.

Anyway, If I was to do it the way you normally do, (using Excell), would I populate each cell in Excell with the data from Access?  Or is there a way to tell excell to use an Access database as the source for its columns somehow?

I dont know how to modify an Access Query at runtime, or a stored procedure. Obviously I could populate a table with only the data i want at runtime, but of course the overhead would be to much.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close