Issues to resolve

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

Hi all,

I'm using Access 2003.

1. I have a form with a print button that suppose to print a report that
based on a query that based on the input of that form. when there are no
results to the query I would like to cancel the print and have a msgbox.

2. I have a table with: WorkID, Customer, Workdate. I'm trying to run a
query the will provide a list of customer. I'm getting the customers' name
more than once. I set the query to unique Values, but it didnt help.

TIA,

Tom
 
Tom,

1. I have a form with a print button that suppose to print a report that
based on a query that based on the input of that form. when there are no
results to the query I would like to cancel the print and have a msgbox.

I shall assume you are using a VBA procedure on the button's Click event
to print the report, using the OpenReport method.

One approach would be to modify the code like this:

If DCount("*","YourQuery") > 0 Then
DoCmd.OpenReport "YourReport"
Else
MsgBox "No matching records"
End If
2. I have a table with: WorkID, Customer, Workdate. I'm trying to run a
query the will provide a list of customer. I'm getting the customers' name
more than once. I set the query to unique Values, but it didnt help.

Are you including the WorkID and/or Workdate fields in the query? I
would expect a query like this:
SELECT DISTINCT Customer FROM YourTable
.... to return the data set you are seeking.
 
Tom,
1. I have a form with a print button that suppose to print a report that
based on a query that based on the input of that form. when there are no
results to the query I would like to cancel the print and have a msgbox.

I shall assume you are using a VBA procedure on the button's Click event
to print the report, using the OpenReport method.

One approach would be to modify the code like this:

If DCount("*","YourQuery") > 0 Then
DoCmd.OpenReport "YourReport"
Else
MsgBox "No matching records"
End If
2. I have a table with: WorkID, Customer, Workdate. I'm trying to run a
query the will provide a list of customer. I'm getting the customers' name
more than once. I set the query to unique Values, but it didnt help.

Are you including the WorkID and/or Workdate fields in the query? I
would expect a query like this:
SELECT DISTINCT Customer FROM YourTable
.... to return the data set you are seeking.
 
Thanks Steve.

Regarding the second question, I do include the workdate field. That is the
critiria for the query.
I need a list of customer between 2 dates, but I would like to see one entry
per cutomer.
Including other fields is a problem?

Thanks again,
Tom
 
Tom,

You can still have the Workdate in the query, for the purpose of
Criteria. But untick the 'Show' box in the query design grid. See how
that goes.
 
Thank you Steve, that worked.

Tom
Steve Schapel said:
Tom,

You can still have the Workdate in the query, for the purpose of Criteria.
But untick the 'Show' box in the query design grid. See how that goes.
 
Back
Top