Print current record

G

Guest

I want to print the current record on a form to a preprinted report using a
command button (I need to print invoices). I set up a query using the
autonumber as a parameter, so it will only print that record. How can I have
it automatically print that record without prompting for criteria?
 
R

Rick B

You don't need to use the query. Just build a report, and modify the
following code to meet your needs...

Private Sub cmdPrint_Click()

Dim strWhere As String

If Me.Dirty Then 'Save any edits.

Me.Dirty = False

End If

If Me.NewRecord Then 'Check there is a record to print

MsgBox "Select a record to print"

Else

strWhere = "[ID] = " & Me.[ID]

DoCmd.OpenReport "MyReport", acViewPreview, , strWhere

End If

End Sub



Notes: If your primary key is a Text type field (not a Number type field),
you need extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

If you want the report to print without preview, replace acViewPreview with
acViewNormal.



See also: http://allenbrowne.com/casu-15.html
 
G

Guest

Thanks, works perfect!

Rick B said:
You don't need to use the query. Just build a report, and modify the
following code to meet your needs...

Private Sub cmdPrint_Click()

Dim strWhere As String

If Me.Dirty Then 'Save any edits.

Me.Dirty = False

End If

If Me.NewRecord Then 'Check there is a record to print

MsgBox "Select a record to print"

Else

strWhere = "[ID] = " & Me.[ID]

DoCmd.OpenReport "MyReport", acViewPreview, , strWhere

End If

End Sub



Notes: If your primary key is a Text type field (not a Number type field),
you need extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

If you want the report to print without preview, replace acViewPreview with
acViewNormal.



See also: http://allenbrowne.com/casu-15.html


--
Rick B



Jennie said:
I want to print the current record on a form to a preprinted report using a
command button (I need to print invoices). I set up a query using the
autonumber as a parameter, so it will only print that record. How can I have
it automatically print that record without prompting for criteria?
 
G

Guest

OK, one more questrion, the code prints individual records, which is what I
want,
but when I click the comman button i want it to only print the current
record, not all. Did I do something wrong? (I put your code on the OnClick
event of the comman button).
Rick B said:
You don't need to use the query. Just build a report, and modify the
following code to meet your needs...

Private Sub cmdPrint_Click()

Dim strWhere As String

If Me.Dirty Then 'Save any edits.

Me.Dirty = False

End If

If Me.NewRecord Then 'Check there is a record to print

MsgBox "Select a record to print"

Else

strWhere = "[ID] = " & Me.[ID]

DoCmd.OpenReport "MyReport", acViewPreview, , strWhere

End If

End Sub



Notes: If your primary key is a Text type field (not a Number type field),
you need extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

If you want the report to print without preview, replace acViewPreview with
acViewNormal.



See also: http://allenbrowne.com/casu-15.html


--
Rick B



Jennie said:
I want to print the current record on a form to a preprinted report using a
command button (I need to print invoices). I set up a query using the
autonumber as a parameter, so it will only print that record. How can I have
it automatically print that record without prompting for criteria?
 
G

Guest

I fixed it! (OK, so it wasn't broken in the first place, I looked at the
report in Preview Mode not using the command button and that's why it did
that, so it was my fault, I can be kinda slow sometimes!) :)

Rick B said:
You don't need to use the query. Just build a report, and modify the
following code to meet your needs...

Private Sub cmdPrint_Click()

Dim strWhere As String

If Me.Dirty Then 'Save any edits.

Me.Dirty = False

End If

If Me.NewRecord Then 'Check there is a record to print

MsgBox "Select a record to print"

Else

strWhere = "[ID] = " & Me.[ID]

DoCmd.OpenReport "MyReport", acViewPreview, , strWhere

End If

End Sub



Notes: If your primary key is a Text type field (not a Number type field),
you need extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

If you want the report to print without preview, replace acViewPreview with
acViewNormal.



See also: http://allenbrowne.com/casu-15.html


--
Rick B



Jennie said:
I want to print the current record on a form to a preprinted report using a
command button (I need to print invoices). I set up a query using the
autonumber as a parameter, so it will only print that record. How can I have
it automatically print that record without prompting for criteria?
 
G

Guest

Now I am having another problem, I attached your code to the command button
on my form, but I also have another form that I want to do the same thing but
with a different set of records. I copied the code but changed the name of
the report and I get an automation error. Any idea why?

Rick B said:
You don't need to use the query. Just build a report, and modify the
following code to meet your needs...

Private Sub cmdPrint_Click()

Dim strWhere As String

If Me.Dirty Then 'Save any edits.

Me.Dirty = False

End If

If Me.NewRecord Then 'Check there is a record to print

MsgBox "Select a record to print"

Else

strWhere = "[ID] = " & Me.[ID]

DoCmd.OpenReport "MyReport", acViewPreview, , strWhere

End If

End Sub



Notes: If your primary key is a Text type field (not a Number type field),
you need extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

If you want the report to print without preview, replace acViewPreview with
acViewNormal.



See also: http://allenbrowne.com/casu-15.html


--
Rick B



Jennie said:
I want to print the current record on a form to a preprinted report using a
command button (I need to print invoices). I set up a query using the
autonumber as a parameter, so it will only print that record. How can I have
it automatically print that record without prompting for criteria?
 
A

Al Camp

Jennie,
Rick's solution is perfectly viable, but... perhaps you'd find my
solution a bit easier to implement. It only takes a moment to set it up and
try.
Just code to Open the Report on cmdPrint_Click, and the query
automatically look to your "calling" form for the filter value it needs.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Jennie said:
Now I am having another problem, I attached your code to the command
button
on my form, but I also have another form that I want to do the same thing
but
with a different set of records. I copied the code but changed the name of
the report and I get an automation error. Any idea why?

Rick B said:
You don't need to use the query. Just build a report, and modify the
following code to meet your needs...

Private Sub cmdPrint_Click()

Dim strWhere As String

If Me.Dirty Then 'Save any edits.

Me.Dirty = False

End If

If Me.NewRecord Then 'Check there is a record to print

MsgBox "Select a record to print"

Else

strWhere = "[ID] = " & Me.[ID]

DoCmd.OpenReport "MyReport", acViewPreview, , strWhere

End If

End Sub



Notes: If your primary key is a Text type field (not a Number type
field),
you need extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

If you want the report to print without preview, replace acViewPreview
with
acViewNormal.



See also: http://allenbrowne.com/casu-15.html


--
Rick B



Jennie said:
I want to print the current record on a form to a preprinted report
using a
command button (I need to print invoices). I set up a query using the
autonumber as a parameter, so it will only print that record. How can I have
it automatically print that record without prompting for criteria?
 
G

Guest

I tried your way and it does work very well but it prompts me for the ID
number. I made sure that the fields were all spelled correctly and
everything. What am I doing wrong?

Al Camp said:
Jennie,
Rick's solution is perfectly viable, but... perhaps you'd find my
solution a bit easier to implement. It only takes a moment to set it up and
try.
Just code to Open the Report on cmdPrint_Click, and the query
automatically look to your "calling" form for the filter value it needs.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Jennie said:
Now I am having another problem, I attached your code to the command
button
on my form, but I also have another form that I want to do the same thing
but
with a different set of records. I copied the code but changed the name of
the report and I get an automation error. Any idea why?

Rick B said:
You don't need to use the query. Just build a report, and modify the
following code to meet your needs...

Private Sub cmdPrint_Click()

Dim strWhere As String

If Me.Dirty Then 'Save any edits.

Me.Dirty = False

End If

If Me.NewRecord Then 'Check there is a record to print

MsgBox "Select a record to print"

Else

strWhere = "[ID] = " & Me.[ID]

DoCmd.OpenReport "MyReport", acViewPreview, , strWhere

End If

End Sub



Notes: If your primary key is a Text type field (not a Number type
field),
you need extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

If you want the report to print without preview, replace acViewPreview
with
acViewNormal.



See also: http://allenbrowne.com/casu-15.html


--
Rick B



I want to print the current record on a form to a preprinted report
using
a
command button (I need to print invoices). I set up a query using the
autonumber as a parameter, so it will only print that record. How can I
have
it automatically print that record without prompting for criteria?
 
A

Al Camp

Jennie... some info please...

What is the name of your form?
What is the name of the field that contains the ID?
Is that field located on the Main form?
Are you leaving the form open as you run the report?

Please copy and paste your query criteria so I can check it against the
questions above.

Also, with the form open, and a legitimate ID selected, try opening the
report in Design mode and just running the RecordSource query via the query
grid. Does the query run?
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Jennie said:
I tried your way and it does work very well but it prompts me for the ID
number. I made sure that the fields were all spelled correctly and
everything. What am I doing wrong?

Al Camp said:
Jennie,
Rick's solution is perfectly viable, but... perhaps you'd find my
solution a bit easier to implement. It only takes a moment to set it up
and
try.
Just code to Open the Report on cmdPrint_Click, and the query
automatically look to your "calling" form for the filter value it needs.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Jennie said:
Now I am having another problem, I attached your code to the command
button
on my form, but I also have another form that I want to do the same
thing
but
with a different set of records. I copied the code but changed the name
of
the report and I get an automation error. Any idea why?

:

You don't need to use the query. Just build a report, and modify the
following code to meet your needs...

Private Sub cmdPrint_Click()

Dim strWhere As String

If Me.Dirty Then 'Save any edits.

Me.Dirty = False

End If

If Me.NewRecord Then 'Check there is a record to print

MsgBox "Select a record to print"

Else

strWhere = "[ID] = " & Me.[ID]

DoCmd.OpenReport "MyReport", acViewPreview, , strWhere

End If

End Sub



Notes: If your primary key is a Text type field (not a Number type
field),
you need extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

If you want the report to print without preview, replace acViewPreview
with
acViewNormal.



See also: http://allenbrowne.com/casu-15.html


--
Rick B



I want to print the current record on a form to a preprinted report
using
a
command button (I need to print invoices). I set up a query using
the
autonumber as a parameter, so it will only print that record. How
can I
have
it automatically print that record without prompting for criteria?
 
G

Guest

Form name = PCardExpenseDataForm
ID Field = ID (located in PCardExpenseDataForm)
The form is open when I run the report

Al Camp said:
Jennie... some info please...

What is the name of your form?
What is the name of the field that contains the ID?
Is that field located on the Main form?
Are you leaving the form open as you run the report?

Please copy and paste your query criteria so I can check it against the
questions above.

Also, with the form open, and a legitimate ID selected, try opening the
report in Design mode and just running the RecordSource query via the query
grid. Does the query run?
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Jennie said:
I tried your way and it does work very well but it prompts me for the ID
number. I made sure that the fields were all spelled correctly and
everything. What am I doing wrong?

Al Camp said:
Jennie,
Rick's solution is perfectly viable, but... perhaps you'd find my
solution a bit easier to implement. It only takes a moment to set it up
and
try.
Just code to Open the Report on cmdPrint_Click, and the query
automatically look to your "calling" form for the filter value it needs.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Now I am having another problem, I attached your code to the command
button
on my form, but I also have another form that I want to do the same
thing
but
with a different set of records. I copied the code but changed the name
of
the report and I get an automation error. Any idea why?

:

You don't need to use the query. Just build a report, and modify the
following code to meet your needs...

Private Sub cmdPrint_Click()

Dim strWhere As String

If Me.Dirty Then 'Save any edits.

Me.Dirty = False

End If

If Me.NewRecord Then 'Check there is a record to print

MsgBox "Select a record to print"

Else

strWhere = "[ID] = " & Me.[ID]

DoCmd.OpenReport "MyReport", acViewPreview, , strWhere

End If

End Sub



Notes: If your primary key is a Text type field (not a Number type
field),
you need extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

If you want the report to print without preview, replace acViewPreview
with
acViewNormal.



See also: http://allenbrowne.com/casu-15.html


--
Rick B



I want to print the current record on a form to a preprinted report
using
a
command button (I need to print invoices). I set up a query using
the
autonumber as a parameter, so it will only print that record. How
can I
have
it automatically print that record without prompting for criteria?
 
A

Al Camp

Jennie,
Thanks for that info... we need it. However you didn't send the query
criteria...Hang in... we'll get it...
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Jennie said:
Form name = PCardExpenseDataForm
ID Field = ID (located in PCardExpenseDataForm)
The form is open when I run the report

Al Camp said:
Jennie... some info please...

What is the name of your form?
What is the name of the field that contains the ID?
Is that field located on the Main form?
Are you leaving the form open as you run the report?

Please copy and paste your query criteria so I can check it against the
questions above.

Also, with the form open, and a legitimate ID selected, try opening the
report in Design mode and just running the RecordSource query via the
query
grid. Does the query run?
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Jennie said:
I tried your way and it does work very well but it prompts me for the ID
number. I made sure that the fields were all spelled correctly and
everything. What am I doing wrong?

:

Jennie,
Rick's solution is perfectly viable, but... perhaps you'd find my
solution a bit easier to implement. It only takes a moment to set it
up
and
try.
Just code to Open the Report on cmdPrint_Click, and the query
automatically look to your "calling" form for the filter value it
needs.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Now I am having another problem, I attached your code to the command
button
on my form, but I also have another form that I want to do the same
thing
but
with a different set of records. I copied the code but changed the
name
of
the report and I get an automation error. Any idea why?

:

You don't need to use the query. Just build a report, and modify
the
following code to meet your needs...

Private Sub cmdPrint_Click()

Dim strWhere As String

If Me.Dirty Then 'Save any edits.

Me.Dirty = False

End If

If Me.NewRecord Then 'Check there is a record to print

MsgBox "Select a record to print"

Else

strWhere = "[ID] = " & Me.[ID]

DoCmd.OpenReport "MyReport", acViewPreview, ,
strWhere

End If

End Sub



Notes: If your primary key is a Text type field (not a Number type
field),
you need extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

If you want the report to print without preview, replace
acViewPreview
with
acViewNormal.



See also: http://allenbrowne.com/casu-15.html


--
Rick B



I want to print the current record on a form to a preprinted
report
using
a
command button (I need to print invoices). I set up a query using
the
autonumber as a parameter, so it will only print that record. How
can I
have
it automatically print that record without prompting for
criteria?
 
G

Guest

Here is my query. Thank you so much, this is driving me crazy!

SELECT PCardExpenseTable.ID AS Expr1, PCardExpenseTable.VENDOR,
PCardExpenseTable.[Transaction Date], PCardExpenseTable.[Transaction Amount],
PCardExpenseTable.[Cost Code], PCardExpenseTable.Description,
PCardExpenseTable.[Line Items], PCardExpenseTable.[Service Area]
FROM PCardExpenseTable
WHERE (((PCardExpenseTable.ID)=[Forms]![PCardExpenseDataForm]![ID]));

Jennie

Al Camp said:
Jennie,
Thanks for that info... we need it. However you didn't send the query
criteria...Hang in... we'll get it...
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Jennie said:
Form name = PCardExpenseDataForm
ID Field = ID (located in PCardExpenseDataForm)
The form is open when I run the report

Al Camp said:
Jennie... some info please...

What is the name of your form?
What is the name of the field that contains the ID?
Is that field located on the Main form?
Are you leaving the form open as you run the report?

Please copy and paste your query criteria so I can check it against the
questions above.

Also, with the form open, and a legitimate ID selected, try opening the
report in Design mode and just running the RecordSource query via the
query
grid. Does the query run?
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

I tried your way and it does work very well but it prompts me for the ID
number. I made sure that the fields were all spelled correctly and
everything. What am I doing wrong?

:

Jennie,
Rick's solution is perfectly viable, but... perhaps you'd find my
solution a bit easier to implement. It only takes a moment to set it
up
and
try.
Just code to Open the Report on cmdPrint_Click, and the query
automatically look to your "calling" form for the filter value it
needs.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Now I am having another problem, I attached your code to the command
button
on my form, but I also have another form that I want to do the same
thing
but
with a different set of records. I copied the code but changed the
name
of
the report and I get an automation error. Any idea why?

:

You don't need to use the query. Just build a report, and modify
the
following code to meet your needs...

Private Sub cmdPrint_Click()

Dim strWhere As String

If Me.Dirty Then 'Save any edits.

Me.Dirty = False

End If

If Me.NewRecord Then 'Check there is a record to print

MsgBox "Select a record to print"

Else

strWhere = "[ID] = " & Me.[ID]

DoCmd.OpenReport "MyReport", acViewPreview, ,
strWhere

End If

End Sub



Notes: If your primary key is a Text type field (not a Number type
field),
you need extra quotes: strWhere = "[ID] = """ & Me.[ID] & """"

If you want the report to print without preview, replace
acViewPreview
with
acViewNormal.



See also: http://allenbrowne.com/casu-15.html


--
Rick B



I want to print the current record on a form to a preprinted
report
using
a
command button (I need to print invoices). I set up a query using
the
autonumber as a parameter, so it will only print that record. How
can I
have
it automatically print that record without prompting for
criteria?
 
A

Al Camp

Jennie,
We're getting there, but... you have to be careful to respond to all my
questions...
In a previous post I requested...
Also, with the form open, and a legitimate ID selected, try opening the
report in Design mode and just running the RecordSource query via the
query design
grid. Does the query run without a prompt? <<<< Important!

This is critical to making sure that something on the Report isn't
triggering the parameter prompt.
Given that the field is called ID, a parameter prompt for "ID#" is
supicious. Is that exactly the field called for in the parameter?

Also, since I don't see anything wrong with...
...WHERE (((PCardExpenseTable.ID)=[Forms]![PCardExpenseDataForm]![ID]));
given that your names are correct. So... we have to continue with problem
determination... is it the query or the report?

If you continue to have problems, and you don't object, you could send me
your mdb file/s to look over. (If it's not too large an mdb) You can be
assured of confidentiality, and of course... no charge.
Try this latest suggestion to narrow down the problem, and post back here
if you intend to send the mdb... via my web site... posted in the signature
(use the Contact button on the home page)

I think we've got some other problem here that I can't ferret out, and
you may not realize.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 
A

Al Camp

Jennie,
Important!! Please zip the mdb/s if you send. Anti Virus programs don't
like .mdb files.
Al
 
G

Guest

Sorry! OK, I tried that and it still prompted for the ID.

Al Camp said:
Jennie,
We're getting there, but... you have to be careful to respond to all my
questions...
In a previous post I requested...
Also, with the form open, and a legitimate ID selected, try opening the
report in Design mode and just running the RecordSource query via the
query design
grid. Does the query run without a prompt? <<<< Important!

This is critical to making sure that something on the Report isn't
triggering the parameter prompt.
Given that the field is called ID, a parameter prompt for "ID#" is
supicious. Is that exactly the field called for in the parameter?

Also, since I don't see anything wrong with...
...WHERE (((PCardExpenseTable.ID)=[Forms]![PCardExpenseDataForm]![ID]));
given that your names are correct. So... we have to continue with problem
determination... is it the query or the report?

If you continue to have problems, and you don't object, you could send me
your mdb file/s to look over. (If it's not too large an mdb) You can be
assured of confidentiality, and of course... no charge.
Try this latest suggestion to narrow down the problem, and post back here
if you intend to send the mdb... via my web site... posted in the signature
(use the Contact button on the home page)

I think we've got some other problem here that I can't ferret out, and
you may not realize.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Jennie said:
It still prompts for the ID#. Any idea why? After I put that in it works
fine.
 
A

Al Camp

Jennie,
If your form was open, and you had a value in the ID field, and the query
(by itself) failed... then you have another parameter call in your query
somewhere.
Create a copy of your query for testing (ex. qryIDPromptTest)
In that query, in query design, delete all columns but ID.
With the form still open, run qryIDPromptTest.

Get a Prompt?

Do you want to send the file? (Zipped and Compacted)

hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Jennie said:
Sorry! OK, I tried that and it still prompted for the ID.

Al Camp said:
Jennie,
We're getting there, but... you have to be careful to respond to all
my
questions...
In a previous post I requested...
Also, with the form open, and a legitimate ID selected, try opening the
report in Design mode and just running the RecordSource query via the
query design
grid. Does the query run without a prompt? <<<< Important!

This is critical to making sure that something on the Report isn't
triggering the parameter prompt.
Given that the field is called ID, a parameter prompt for "ID#" is
supicious. Is that exactly the field called for in the parameter?

Also, since I don't see anything wrong with...
...WHERE
(((PCardExpenseTable.ID)=[Forms]![PCardExpenseDataForm]![ID]));
given that your names are correct. So... we have to continue with
problem
determination... is it the query or the report?

If you continue to have problems, and you don't object, you could send
me
your mdb file/s to look over. (If it's not too large an mdb) You can
be
assured of confidentiality, and of course... no charge.
Try this latest suggestion to narrow down the problem, and post back
here
if you intend to send the mdb... via my web site... posted in the
signature
(use the Contact button on the home page)

I think we've got some other problem here that I can't ferret out, and
you may not realize.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Jennie said:
It still prompts for the ID#. Any idea why? After I put that in it
works
fine.

:

Jennie,
In the query behind the report, use this criteria against your
autonumber
field...
=Forms!frmYourFormName!YourIDFieldName
That should only print the exact match record.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

I want to print the current record on a form to a preprinted report
using a
command button (I need to print invoices). I set up a query using
the
autonumber as a parameter, so it will only print that record. How
can I
have
it automatically print that record without prompting for criteria?
 
G

Guest

I ran the query with only the ID field and I still got a prompt. How do I
send the database?

Al Camp said:
Jennie,
If your form was open, and you had a value in the ID field, and the query
(by itself) failed... then you have another parameter call in your query
somewhere.
Create a copy of your query for testing (ex. qryIDPromptTest)
In that query, in query design, delete all columns but ID.
With the form still open, run qryIDPromptTest.

Get a Prompt?

Do you want to send the file? (Zipped and Compacted)

hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Jennie said:
Sorry! OK, I tried that and it still prompted for the ID.

Al Camp said:
Jennie,
We're getting there, but... you have to be careful to respond to all
my
questions...
In a previous post I requested...
Also, with the form open, and a legitimate ID selected, try opening the
report in Design mode and just running the RecordSource query via the
query design
grid. Does the query run without a prompt? <<<< Important!

This is critical to making sure that something on the Report isn't
triggering the parameter prompt.
Given that the field is called ID, a parameter prompt for "ID#" is
supicious. Is that exactly the field called for in the parameter?

Also, since I don't see anything wrong with...
...WHERE
(((PCardExpenseTable.ID)=[Forms]![PCardExpenseDataForm]![ID]));
given that your names are correct. So... we have to continue with
problem
determination... is it the query or the report?

If you continue to have problems, and you don't object, you could send
me
your mdb file/s to look over. (If it's not too large an mdb) You can
be
assured of confidentiality, and of course... no charge.
Try this latest suggestion to narrow down the problem, and post back
here
if you intend to send the mdb... via my web site... posted in the
signature
(use the Contact button on the home page)

I think we've got some other problem here that I can't ferret out, and
you may not realize.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


It still prompts for the ID#. Any idea why? After I put that in it
works
fine.

:

Jennie,
In the query behind the report, use this criteria against your
autonumber
field...
=Forms!frmYourFormName!YourIDFieldName
That should only print the exact match record.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

I want to print the current record on a form to a preprinted report
using a
command button (I need to print invoices). I set up a query using
the
autonumber as a parameter, so it will only print that record. How
can I
have
it automatically print that record without prompting for criteria?
 
A

Al Camp

Use my website indicated below, and click the Contact button.
Please Compact and Zip...
--
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

Jennie said:
I ran the query with only the ID field and I still got a prompt. How do I
send the database?

Al Camp said:
Jennie,
If your form was open, and you had a value in the ID field, and the
query
(by itself) failed... then you have another parameter call in your query
somewhere.
Create a copy of your query for testing (ex. qryIDPromptTest)
In that query, in query design, delete all columns but ID.
With the form still open, run qryIDPromptTest.

Get a Prompt?

Do you want to send the file? (Zipped and Compacted)

hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Jennie said:
Sorry! OK, I tried that and it still prompted for the ID.

:

Jennie,
We're getting there, but... you have to be careful to respond to
all
my
questions...
In a previous post I requested...
Also, with the form open, and a legitimate ID selected, try opening
the
report in Design mode and just running the RecordSource query via
the
query design
grid. Does the query run without a prompt? <<<< Important!

This is critical to making sure that something on the Report isn't
triggering the parameter prompt.
Given that the field is called ID, a parameter prompt for "ID#" is
supicious. Is that exactly the field called for in the parameter?

Also, since I don't see anything wrong with...
...WHERE
(((PCardExpenseTable.ID)=[Forms]![PCardExpenseDataForm]![ID]));
given that your names are correct. So... we have to continue with
problem
determination... is it the query or the report?

If you continue to have problems, and you don't object, you could
send
me
your mdb file/s to look over. (If it's not too large an mdb) You
can
be
assured of confidentiality, and of course... no charge.
Try this latest suggestion to narrow down the problem, and post
back
here
if you intend to send the mdb... via my web site... posted in the
signature
(use the Contact button on the home page)

I think we've got some other problem here that I can't ferret out,
and
you may not realize.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


It still prompts for the ID#. Any idea why? After I put that in it
works
fine.

:

Jennie,
In the query behind the report, use this criteria against your
autonumber
field...
=Forms!frmYourFormName!YourIDFieldName
That should only print the exact match record.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

I want to print the current record on a form to a preprinted
report
using a
command button (I need to print invoices). I set up a query using
the
autonumber as a parameter, so it will only print that record. How
can I
have
it automatically print that record without prompting for
criteria?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top