Hi Mike,
Always make sure you have a backup copy or two before making changes.
Backing up the entire app is best, and I do that regularly, but sometimes
between backups I'll just make a copy of an object I'm working on so if I
'mess up' I can delete the one I was working on and use the copy (after
copying it again!).
What you have is a parameter query. What you can do is replace the entries
like this:
[Enter Employee Name]
in the query criteria row with references to your form's control values like
this:
=Forms!YourFormName!YourControlName
where 'YourFormName is the name of your form, and 'YourControlName' is the
name of the control with the employee name.
There's a couple of 'gotchas' to be aware of. First, if you use that query
elsewhere in your application, and it's working in that other place now, and
you change it, well, it's not going to work in that other place anymore. I
think that's pretty unlikely with a parameter query, but not inconceivable.
You could, if necessary, just make a copy of it for each use, but you would
also have to make sure whatever needs to use the copy has the appropriate
changes made to point to it instead of the original.
Second, combo boxes can be a little tricky, because they usually have more
than one column in their rows (choices), even if only one column is visible.
You may need to check the rowsource of the combo box if one of your
references in your query points to a combo box. You can ask about that in
another question if you have trouble with it, or I'll try to watch this but
I'm in and out this weekend.
The broader point is to remember that whatever values your query column
holds (strings, numbers, dates, etc), you have to point to a control (or
column in a control box or list box if they have multiple columns) that has
that kind of value.
There is another way to solve your issue, and in the long term it's a better
way imo, but probably doesn't really matter here.
You could just remove all the things in the criteria row of the query and
use the openreport method on the click event of your button, but that can get
a little tricky with multiple criteria and the quotes if you aren't use to
doing it. It's 'cleaner', imo, because then your query doesn't have hard
coded criteria, but frequently it doesn't really matter if the query does
have hard coded criteria.
HTH,
CW
Mike said:
Hi,
Yes the report is run through a query which is filtered like you have
described.
Mike
:
Hi Mike,
Is your report based on a query? If so, if you open the query in design
view, do you see things like the following in the criteria row of the query
grid:
[Enter Employee Name]
[Input Begin Date]
[Enter End Date]
??
CW
:
Hi,
Can anyone offer any tips/advice. I would like to use a command button to
open up a report for the current open record. So for example i have opened a
record up in the name of "Superted" on my form and I want to e-mail Superted
with his "Spotty Report". What I am doing at the moment is clicking on my
command button to send an email of the report, for which i created a macro,
but before it will attach the report, I am having to type in the data such as
name and the date range i want to show on the report. My concern is that
someone may enter the wrong information and send the wrong report or details.
All the information required for report is already stored on each of the
records. Is there anyway i can use the record information to generate the
report without entering the values and just use the values recorded on the
record?