Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > How do I get Access to output a report from a multi-parameter form?


Reply
 
Thread Tools Display Modes
  #1  
Old 05-24-2010, 05:20 PM
Ludicroushalo Ludicroushalo is offline
Newcomer
 
Join Date: May 2010
Posts: 4
Unhappy How do I get Access to output a report from a multi-parameter form?


How do I get MSAccess to output a report from a multi-parameter form which restricts the list of fields output based on tickboxes?
I have created an Access form which is built on a multi-parameter query.
The form triggers the query from a command button on the form which calls the query from Docmd.Openquery.....(which all works fine)
I am trying to restrict the output in the report so that only certain fields from the query appear based on the user ticking boxes ie -

Field_firstname, Field_surname, Field_dob
John Smith 10/04/1969
Jane Doe 01/02/1978

I want the user to be able to use a tick box on the form which enables the user to select whether they want the first name or surname to appear in the results of the query (which I then want to output only as a report or export to Word/Excel). So my question has 2 parts - How do I restrict my output fields from the query and how do I get my form results to output to a report?
Reply With Quote
  #2  
Old 05-28-2010, 06:15 AM
Roscoe's Avatar
Roscoe Roscoe is offline
Centurion
 
Join Date: Sep 2003
Location: Marin county, SF bay area
Posts: 112
Default

For me, the easiest way would be to build an SQL string using VBA in the form's module. It would involve a lot of lines like: If checkboxA.Value = 1 then SQLstring = SQLstr & 'LastName'...
I don't know how much experience you have with VB strings.
__________________
"The opposite of a correct statement is a false statement. But the opposite of a profound truth may well be another profound truth."
Niels Bohr
Reply With Quote
  #3  
Old 06-02-2010, 02:40 PM
Ludicroushalo Ludicroushalo is offline
Newcomer
 
Join Date: May 2010
Posts: 4
Thumbs down Reply to thread 'How do I get Access to output a report from a multi-parameter form?

Thanks for that - yes I tried using SQL to create the string and it worked in that it gave me the required output but the report was a real mess so I then set about trying to change the layout of the report and hit a few more snags.

One of my fields is of type "memo" and I can only create a variable for text types - can't do it for "memo" types so every field was cutting off at 255 characters. Is it possible to get round that?

On top of that, although I should have been able to change the layout of the page to landscape to give me a wider page output, no matter what I did within the script, the output always came out as A4/letter portrait layout.
Is it possilble to get round that (or is it determined by the printer drivers?

Thanks for any help with this.
Reply With Quote
Reply

Tags
access, form, parameters, query, report


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->