By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,164 Members | 1,001 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,164 IT Pros & Developers. It's quick & easy.

generate a report from the current form viewed

P: 2
Hello

This is my first post on the forum so hello everyone.

I have a problem with access that I can't manage to view the current form record as a report ready to be printed.

I have a list of clients that when viewed in a form, i need to be able to generate a letter with their details already filled in.

I've tried various version of the same code to try to achieve this, but all it can do is pull out and fill in the report for the first record of the client list.

DoCmd.OpenReport "courseLetter", acViewPreview, , _
'"[client_client_id] = " & Me.client_id

DoCmd.OpenReport "courseLetter", acViewPreview, , "client_client_id=Forms!Me!client_id"

DoCmd.OpenReport "courseLetter", acViewPreview, , "[client_client_id] = " & Me![client_id]

DoCmd.OpenReport "courseLetter", acViewPreview, , "[client_client_id] = " & Me!client_id


The client_id is called client_client_id on the report.

This is the current SQL for the report (found in the properties panel)

SELECT [client].[client_name], [client].[client_id] AS client_client_id, [contacts].[contact_id], [contacts].[contact_title], [contacts].[contact_name], [contacts].[contact_sub_premises_name], [contacts].[contact_premises_name], [contacts].[contact_thoroughfare_no], [contacts].[contact_thoroughfare_name], [contacts].[contact_locality], [contacts].[contact_town], [contacts].[contact_county], [contacts].[contact_postcode], [contacts].[contact_telephone], [contacts].[contact_mobile], [contacts].[contact_fax], [contacts].[contact_web_address], [contacts].[contact_email], [contacts].[client_id] AS contacts_client_id, [courses].[course_id], [courses].[course_title], [courses].[client_id] AS courses_client_id FROM (client INNER JOIN courses ON [client].[client_id]=[courses].[client_id]) INNER JOIN contacts ON [client].[client_id]=[contacts].[client_id];

I hope you geniouses can help me on this matter as I'm fresh out of solutions!

Thanks in advance

David
Sep 12 '07 #1
Share this Question
Share on Google+
2 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
Hi David

Is client_id a text or a number field?

If its a text field then try the following instead.

DoCmd.OpenReport "courseLetter", acViewPreview, , "[client_client_id] = '" & Me![client_id] & "'"
Sep 12 '07 #2

P: 2
Hi David

Is client_id a text or a number field?

If its a text field then try the following instead.

DoCmd.OpenReport "courseLetter", acViewPreview, , "[client_client_id] = '" & Me![client_id] & "'"

nah client_id is just an autonumber field i'm afraid. Do you have any other suggestions?
Sep 13 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.