Report base on a query from a form?

  • Thread starter Thread starter john
  • Start date Start date
J

john

I have a form/subform that has a work ticket number on it along with customer
info. Once I enter the data I want to print 3 reports, 2 are the same and
one is different. The reports are base on that specific work ticket. I
currently created the reports based on a query that asks for the ticket
number. Then i created a macro that runs the 3 reports. The only issue i
have is that i have enter the ticket number everytime. Is there an easier
way?
 
John,

Yes. In the query that the reports are based on, enter the equivalent of
the following in the Criteria of the ticket number field:
[Forms]![NameOfYourForm]![Ticket Number]
 
Thanks for the info but it dosen't seem to be working. The report is blank.
If I run the query stand alone it asks for the ticket number and everything
works but when I have the form open and run the query it just comes up blank.

Steve Schapel said:
John,

Yes. In the query that the reports are based on, enter the equivalent of
the following in the Criteria of the ticket number field:
[Forms]![NameOfYourForm]![Ticket Number]

--
Steve Schapel, Microsoft Access MVP


john said:
I have a form/subform that has a work ticket number on it along with
customer
info. Once I enter the data I want to print 3 reports, 2 are the same and
one is different. The reports are base on that specific work ticket. I
currently created the reports based on a query that asks for the ticket
number. Then i created a macro that runs the 3 reports. The only issue i
have is that i have enter the ticket number everytime. Is there an easier
way?

.
 
John,

Where I said:
[Forms]![NameOfYourForm]![Ticket Number]
.... you need to substitute the actual name of the form, and the actual name
of the textbox where you have the ticket number on the form. Is that what
you did?

--
Steve Schapel, Microsoft Access MVP


john said:
Thanks for the info but it dosen't seem to be working. The report is
blank.
If I run the query stand alone it asks for the ticket number and
everything
works but when I have the form open and run the query it just comes up
blank.

Steve Schapel said:
John,

Yes. In the query that the reports are based on, enter the equivalent of
the following in the Criteria of the ticket number field:
[Forms]![NameOfYourForm]![Ticket Number]
 
John,

Ah, here's another thought... If this is a newly entered record on the
form, you may need to explicitly save it before the query will work, as it
doesn't actually exist in the table until it is saved.

--
Steve Schapel, Microsoft Access MVP


john said:
Thanks for the info but it dosen't seem to be working. The report is
blank.
If I run the query stand alone it asks for the ticket number and
everything
works but when I have the form open and run the query it just comes up
blank.

Steve Schapel said:
John,

Yes. In the query that the reports are based on, enter the equivalent of
the following in the Criteria of the ticket number field:
[Forms]![NameOfYourForm]![Ticket Number]
 
Steve, Thanks for you help but for some reason it's not working. This is
what I have in the query:

[Forms]![Main Form]![Subform].[Form]![ticket number]

When I test this from the query it asks for the ticket number. When I test
it from the from that even has old records it still asks for the ticket
number. I tried it your way and it did the same thing.

Any suggestions?

Steve Schapel said:
John,

Ah, here's another thought... If this is a newly entered record on the
form, you may need to explicitly save it before the query will work, as it
doesn't actually exist in the table until it is saved.

--
Steve Schapel, Microsoft Access MVP


john said:
Thanks for the info but it dosen't seem to be working. The report is
blank.
If I run the query stand alone it asks for the ticket number and
everything
works but when I have the form open and run the query it just comes up
blank.

Steve Schapel said:
John,

Yes. In the query that the reports are based on, enter the equivalent of
the following in the Criteria of the ticket number field:
[Forms]![NameOfYourForm]![Ticket Number]


.
 
John,

When you say [Forms]![Main Form]![Subform].[Form]![ticket number], I assume
you do not actually have a form named 'Main Form' and a subform named
'Subform'? That the names of the form and subform are different. Can you
tell what you actually have? The name of the subform on the main form is
not necessarily the same as the name of the form that is embedded in the
subform, if you catch the distinction. If these names are different, it is
the name of the subform control that is needed in the expression.
Similarly, the name of the textbox on the form may not necessarily be the
same as the name of the field it is bound to. If they are different, I
think you need the name of the textbox control. So, is the field actually
named 'ticket number'? if so, is the name of the textbox on the form also
named 'ticket number'?

Also, when you say "I test this from the query", do you mean that the form
is open at the time?

--
Steve Schapel, Microsoft Access MVP


john said:
Steve, Thanks for you help but for some reason it's not working. This is
what I have in the query:

[Forms]![Main Form]![Subform].[Form]![ticket number]

When I test this from the query it asks for the ticket number. When I
test
it from the from that even has old records it still asks for the ticket
number. I tried it your way and it did the same thing.

Any suggestions?

Steve Schapel said:
John,

Ah, here's another thought... If this is a newly entered record on the
form, you may need to explicitly save it before the query will work, as
it
doesn't actually exist in the table until it is saved.

--
Steve Schapel, Microsoft Access MVP


john said:
Thanks for the info but it dosen't seem to be working. The report is
blank.
If I run the query stand alone it asks for the ticket number and
everything
works but when I have the form open and run the query it just comes up
blank.

:

John,

Yes. In the query that the reports are based on, enter the equivalent
of
the following in the Criteria of the ticket number field:
[Forms]![NameOfYourForm]![Ticket Number]


.
 
"Frm New Service Ticket" is the main form. "Subform Work Order" is the
Subform.
The name and control source for the field is "Work Order Number"

The embedded subform has the same name as the Subform.

Yes. When I test the query the form is open.

Thanks.



Steve Schapel said:
John,

When you say [Forms]![Main Form]![Subform].[Form]![ticket number], I assume
you do not actually have a form named 'Main Form' and a subform named
'Subform'? That the names of the form and subform are different. Can you
tell what you actually have? The name of the subform on the main form is
not necessarily the same as the name of the form that is embedded in the
subform, if you catch the distinction. If these names are different, it is
the name of the subform control that is needed in the expression.
Similarly, the name of the textbox on the form may not necessarily be the
same as the name of the field it is bound to. If they are different, I
think you need the name of the textbox control. So, is the field actually
named 'ticket number'? if so, is the name of the textbox on the form also
named 'ticket number'?

Also, when you say "I test this from the query", do you mean that the form
is open at the time?

--
Steve Schapel, Microsoft Access MVP


john said:
Steve, Thanks for you help but for some reason it's not working. This is
what I have in the query:

[Forms]![Main Form]![Subform].[Form]![ticket number]

When I test this from the query it asks for the ticket number. When I
test
it from the from that even has old records it still asks for the ticket
number. I tried it your way and it did the same thing.

Any suggestions?

Steve Schapel said:
John,

Ah, here's another thought... If this is a newly entered record on the
form, you may need to explicitly save it before the query will work, as
it
doesn't actually exist in the table until it is saved.

--
Steve Schapel, Microsoft Access MVP


Thanks for the info but it dosen't seem to be working. The report is
blank.
If I run the query stand alone it asks for the ticket number and
everything
works but when I have the form open and run the query it just comes up
blank.

:

John,

Yes. In the query that the reports are based on, enter the equivalent
of
the following in the Criteria of the ticket number field:
[Forms]![NameOfYourForm]![Ticket Number]



.
.
 
John,

Ok. So in the Criteria of your query, you hver like this?...
[Forms]![Frm New Service Ticket]![Subform Work Order]![Work Order Number]

If so, when you run the query you get (as I understand it) a 'Enter
Parameter Value' prompt. Is that asking for the value of 'Work Order
Number'?

Sorry to be getting finickety here. But this type of behaviour points to
somewhere there being something spelled incorrectly, or a field/control
missing from the form or query, or some such, so just trying to investigate
that angle.
 
Back
Top