Print Access State Records

Jarlo Posted messages 16 Status Membre -  
 Michel -
Hello,

I would like to print a record from a report generated from a form. Unfortunately, Access always prints all records, while I only want to print the record I’m currently working on, and I want Access to remember this setting whenever I want to print.

Thank you for your guidance, and I'm sorry if this topic has already been addressed in another discussion, despite my preliminary search.
Configuration: Windows 2000 Firefox 2.0.0.12

19 réponses

LatelyGeek Posted messages 1774 Registration date   Status Membre Last intervention   550
 
Normally, if you have correctly filled in the criteria, Access will read the field value in the form without asking you anything.

Your report already exists. It is based on the table.
You switch it to design view, select the report, display the properties, go to the Source area, which should contain the name of your table, and click on the builder button on the right. Access should ask you "Do you want to create a query based on this table?", you answer Yes.

You include all the fields with the asterisk, plus the field on which you want to apply the criteria, by unchecking the "Show" box.
In the Criteria area of this field, you right-click, choose create, in the left part of the Wizard, you choose Forms - All forms - and the name of your form, and in the central part, you double-click on the name of the field identifying the record to print. In the top part should appear Forms!YourFormName!FieldName.

You confirm and it should work!
12
beingdavidm
 
I've been looking for how to do this for ages!! Thank you thank you thank you it works great!
0
Michel
 
Great, it works on the first try!!!
clear explanations, a simple process
well done

Michel
0
Jarlo Posted messages 16 Status Membre 2
 
Thank you very much LatelyGeek for taking the time to explain everything to me in detail.

I did what you told me, but it only works halfway.

That is to say, when I click on the button that leads to the report in print preview mode, it only shows me one record, just as I wanted.

However, the report is empty!

Furthermore, when the report appears, it asks me to select the record I want, just like when printing, which I don’t want, of course.

And if in the query I only put a star instead of the specific criterion in the desired field, it doesn’t ask me anything, but the report is still empty!

Thank you again for helping me, if you have any idea about the cause and the solution to this problem...
2
LatelyGeek Posted messages 1774 Registration date   Status Membre Last intervention   550
 
Where are you launching the print from? From a form? If so, you just need to base the report not on the table containing the information to be printed, but on a query based on that table with a criterion on the field identifying the record (for example, Forms!FormNameCalling!MemberID if you want to print the record of a specific member)

Otherwise, a parameterized criterion [Enter the member number for whom you want to print the record]
0
Jarlo Posted messages 16 Status Membre 2
 
Thank you LatelyGeek

I launch the printing from a form, in which I put a command button that redirects me to a report to then print it.

When the report appears, the first record from the table shows up, but if I click on next, I realize that they all appear. However, I would like to print only the record I just viewed, for example, number 58, and not all 250 records from the table.

A parameterized criterion doesn't interest me because I always print the form I just filled out (well, its state).

Do you understand?
0
LatelyGeek Posted messages 1774 Registration date   Status Membre Last intervention   550
 
Yes, yes, I gave you the answer, by the way, I understood it so well!

State based on a query containing a criterion referencing the form you just left.

The syntax of the criterion is
forms!FormName!FieldName
0
Jarlo Posted messages 16 Status Membre 2
 
Sure, but when I execute the query, a window appears asking me to fill in the chosen field. That's not what I want.

Where should I insert the syntax for the criteria? I select the table, then the field, then this criterion? Is it like this: ? (this is an example)

forms!Facture!Prix

Additionally, can I modify the source of the report, that is, the query instead of the table, from the report itself instead of having to redo the report again?

Thank you.
0
LatelyGeek Posted messages 1774 Registration date   Status Membre Last intervention   550
 
You need to pay attention to spelling - and to the accuracy of requests to spare your colleagues' brains...

How do you expect me to respond if you don't tell me

1- What criteria you set
2 - The message that Access displays to you.

I know where your problem comes from, you made a mistake of imprecision - accent, space, etc., I'm 99% sure of it. But I'm not Madame Soleil and honestly, from a distance, I wouldn't be able to tell you where!!!!
0
Jarlo Posted messages 16 Status Membre 2
 
Sorry, I'm having trouble explaining because I'm in Spain, everything is in Spanish and I'm struggling to remember the terms in French or to translate them. (You could say, just go to Spanish forums! lol)

As a criterion, I set forms!FormName!FieldName

The message that Access displays to me is to enter the value for the field for which I've defined the criterion.

You know well, you don't have to keep helping me, you've already done a lot.

Thank you.
0
LatelyGeek Posted messages 1774 Registration date   Status Membre Last intervention   550
 
No, I would like the exact syntax, for example Forms!Invoice!InvoiceNumber, and the exact syntax of the parameter that Access asks you to enter the value for...
0
Jarlo Posted messages 16 Status Membre 2
 
The exact syntax of the criterion I put in the query:

[Formularios]![Acogida-Perfil]![Nº Exp:]

And the exact syntax of the parameter that Access asks me to enter the value is:

Formularios!Acogida-Perfil!Nº Exp: when I execute the query

and

Nº Exp: meaning the field name when I click on the button in the form that takes me to the print preview of the report.
0
Jarlo Posted messages 16 Status Membre 2
 
I would like to thank LatelyGeek because thanks to your advice, I solved my problem. I don’t know if I had written the criteria incorrectly or not, but anyway.

¡Hasta luego! :-)
0
LatelyGeek Posted messages 1774 Registration date   Status Membre Last intervention   550
 
Glad you resolved your issue, I don't see where the mistake was, but oh well!!!
0
Jarlo Posted messages 16 Status Membre 2
 
I am reviving the topic because I am faced with another problem related to the last one.

In the form, when I click on the button that takes me to the state, sometimes the state is filled in, other times it isn't! I don't understand the logic, where the error comes from... I've checked the properties in the table but I don't see anything.

I hope I'm not being too vague in my explanations.

Any ideas?
0
LatelyGeek Posted messages 1774 Registration date   Status Membre Last intervention   550
 
To be frank, you're totally too vague in your explanations!!!

We don't know if the report is based on a table or a query, to start with. We assume it's a query; otherwise, the result would be the same every time, unless you delete records from one instance to the next.

So we can assume that the query on which the report is based has a criterion that sometimes results in this query being empty, but that's about the only assumption we can make for now.

Please provide some clarifications!!!
0
Jarlo Posted messages 16 Status Membre 2
 
Computing is sometimes like philosophy; you just need to take a step back, stop for 5 minutes, think, listen to others, and ask questions.

I accidentally put a criterion in another field that unknowingly filtered the records. Thank you, Latelygeek.

By the way, do you know how to make it so that in the state, when printed, the names of the entered values appear instead of those entered in the key field, that is, numbers? Or even so that all values from a dropdown list appear on the paper?

Thank you.
0
LatelyGeek Posted messages 1774 Registration date   Status Membre Last intervention   550
 
Yes, if you have a mapping table between the key field numbers and the values you want to appear, you just need to relate those two tables in the query on which the report is based, and insert the fields from that mapping table into the report.
0
Jarlo Posted messages 16 Status Membre 2
 
Thank you Latelygeek, but I don't understand what this mapping table is...

I'll be specific. I have a table. In the table, I have 3 fields: Professional number, Professional 1, Professional 2 with dropdown lists for the last two and a number for the first.

In the form, when I select a value from a dropdown list, that name does indeed appear. But when I read the report (made from this form) that is printed, only the values of the key field, that is, a number, appear.

Do you see what I mean?

Thank you.
0
LatelyGeek Posted messages 1774 Registration date   Status Membre Last intervention   550
 
No, I don't quite understand. If you only have one table....

What exactly do the dropdown lists in the table contain??? A list of values? And which field are you referring to in the form that should return text but gives a number????
--
Why make life complicated when it's so easy to make it simple?
0
sorigeo
 
Private Sub Commande149_Click()

'Print the invoice from the print button in the invoice form

On Error GoTo Err_Commande149_Click

Dim stDocName As String

stDocName = "Report Name"
DoCmd.OpenReport stDocName, , , "Invoice_Number=" & Me.Num_Facture

'DoCmd.OpenReport "Report Name", acViewReport

Exit_Commande149_Click:
Exit Sub

Err_Commande149_Click:
MsgBox Err.Description
Resume Exit_Commande149_Click

End Sub
0