473,385 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

generate a report from the current form viewed

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
2 1825
MMcCarthy
14,534 Expert Mod 8TB
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
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

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

Similar topics

1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
0
by: Dean Sabella | last post by:
Hi, I was trying to run a crystal report in the .net sample application given at: http://support.crystaldecisions.com/communityCS/FilesAndUpdates/ cppnet_win_subreport_basic.exe.asp (I've...
3
by: Damian | last post by:
Hi everyone I'm having an issue with one of our applications. I'm getting the following error when attempting to log in to the site: Server Error in 'xxxxxxxxxxxxxxxx' Application....
5
by: ken | last post by:
how ASP.NET to generate excel report(office 2003) to client what component i need to reference into the asp.net application and what component i need to install to the server? Moreover, does it...
0
by: ward | last post by:
Greetings. Ok, I admit it, I bit off a bit more than I can chew. I need to complete this "Generate Report" page for my employer and I'm a little over my head. I could use some additional...
11
by: Ryan | last post by:
I am writing a VB (2005) program that will allow the user to fill out and print a form. The form input is stored in a database (SQL 2005) to be retrieved/viewed/printed later. The form is...
2
by: ssmith147 | last post by:
Hi, I'm somewhat familiar with access and vb programming (I can read someone else's code, for the most part), but I'm still very green when it comes to creating solutions for my own needs. I'm...
3
by: franc sutherland | last post by:
Hello, I have a report which I filter using the me.filter command in the OnOpen event. Me.Filter = "OrderID=" & Forms!variable_form_name! Me.FilterOn = True I want to be able to open that...
4
by: RachH | last post by:
Is there a way to pass a value to a report via VBA so the value can then be displayed in the report as a concantenation with a string? I have a report that displays all pricings that have occured...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.