473,396 Members | 1,864 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,396 software developers and data experts.

View only selected fields

Hi

I'm creating a fairly simple Staff database using Access 97.

There is a table, which stores all of the staff details (initials,
firstname, surname, tel. no. etc.) and I want to design a dynamic
reporting system whereby users can select which fields they want to
report on. i.e. users select surname and tel. no. and these details
are displayed in a report for them.

I created a form with a multi-select listbox, which lists the field
names (initials, firstname, surname, tel. no. etc.) and the selected
values arestored in a table.

My problem is getting the report to only disply the required fields. I
*think* I may need some sort of IIF statement within a query, but I'm
not too sure.

Any advice greatly received.

Dave
Nov 13 '05 #1
2 1510
wa**********@hotmail.com (Dave) wrote in message news:<7e**************************@posting.google. com>...
Hi

I'm creating a fairly simple Staff database using Access 97.

There is a table, which stores all of the staff details (initials,
firstname, surname, tel. no. etc.) and I want to design a dynamic
reporting system whereby users can select which fields they want to
report on. i.e. users select surname and tel. no. and these details
are displayed in a report for them.

I created a form with a multi-select listbox, which lists the field
names (initials, firstname, surname, tel. no. etc.) and the selected
values arestored in a table.

My problem is getting the report to only disply the required fields. I
*think* I may need some sort of IIF statement within a query, but I'm
not too sure.

Any advice greatly received.

Dave


I use a separate form for the user to specify the field order and
custom headings in tblFlexReportColumnOrder. Once the column order
has been specified, use the SQL string to get just the field names
that are actually used.

tblFlexReportColumnOrder:
ColumnName Text
ListOrderNumber Long
ReportColumnName Text
ValsIndex Long
FieldType Text
MaxWidth Long
ActualWidth Long

The code is placed in Sub Report_Open

strSQL = "SELECT * FROM tblFlexReportColumnOrder WHERE "
strSQL = strSQL & "[ListOrderNumber] > 0 "
strSQL = strSQL & "ORDER BY ListOrderNumber;"

I use field names as part of the names of the textboxes on the report
LabelName(lngI) = "lbl" & ColumnName(lngI)
TextBoxName(lngI) = "txt" & ColumnName(lngI)
TotalBoxName(lngI) = "txtTotal" & ColumnName(lngI)

I only show the textboxes that are actually used
Report_rptFlexLegal.Controls(LabelName(lngI)).Prop erties("Caption")
= ReportColumnName(lngI)
Report_rptFlexLegal.Controls(LabelName(lngI)).Prop erties("Visible")
= True
Report_rptFlexLegal.Controls(TextBoxName(lngI)).Pr operties("Visible")
= True
Report_rptFlexLegal.Controls(TotalBoxName(lngI)).P roperties("Visible")
= True

I also size them and slide them over (note: sizes are in twips--1440
per inch)
Report_rptFlexLegal.Controls(TextBoxName(lngJ)).Pr operties("Width")
= Int(FieldWidth(lngJ))
Report_rptFlexLegal.Controls(LabelName(lngJ)).Prop erties("Width") =
Int(FieldWidth(lngJ))
Report_rptFlexLegal.Controls(TotalBoxName(lngJ)).P roperties("Width")
= Int(FieldWidth(lngJ))
Report_rptFlexLegal.Controls(TextBoxName(lngJ)).Pr operties("Left")
= LeftNumber(lngJ)
Report_rptFlexLegal.Controls(LabelName(lngJ)).Prop erties("Left") =
LeftNumber(lngJ)
Report_rptFlexLegal.Controls(TotalBoxName(lngJ)).P roperties("Left")
= LeftNumber(lngJ)

Check for older postings in this NG since other people have come up
with other ways of doing this.

James A. Fortune
Nov 13 '05 #2
ja******@oakland.edu (James Fortune) wrote in message news:<a6**************************@posting.google. com>...
wa**********@hotmail.com (Dave) wrote in message news:<7e**************************@posting.google. com>...
Hi

I'm creating a fairly simple Staff database using Access 97.

There is a table, which stores all of the staff details (initials,
firstname, surname, tel. no. etc.) and I want to design a dynamic
reporting system whereby users can select which fields they want to
report on. i.e. users select surname and tel. no. and these details
are displayed in a report for them.

I created a form with a multi-select listbox, which lists the field
names (initials, firstname, surname, tel. no. etc.) and the selected
values arestored in a table.

My problem is getting the report to only disply the required fields. I
*think* I may need some sort of IIF statement within a query, but I'm
not too sure.

Any advice greatly received.

Dave


I use a separate form for the user to specify the field order and
custom headings in tblFlexReportColumnOrder. Once the column order
has been specified, use the SQL string to get just the field names
that are actually used.

tblFlexReportColumnOrder:
ColumnName Text
ListOrderNumber Long
ReportColumnName Text
ValsIndex Long
FieldType Text
MaxWidth Long
ActualWidth Long

The code is placed in Sub Report_Open

strSQL = "SELECT * FROM tblFlexReportColumnOrder WHERE "
strSQL = strSQL & "[ListOrderNumber] > 0 "
strSQL = strSQL & "ORDER BY ListOrderNumber;"

I use field names as part of the names of the textboxes on the report
LabelName(lngI) = "lbl" & ColumnName(lngI)
TextBoxName(lngI) = "txt" & ColumnName(lngI)
TotalBoxName(lngI) = "txtTotal" & ColumnName(lngI)

I only show the textboxes that are actually used
Report_rptFlexLegal.Controls(LabelName(lngI)).Prop erties("Caption")
= ReportColumnName(lngI)
Report_rptFlexLegal.Controls(LabelName(lngI)).Prop erties("Visible")
= True
Report_rptFlexLegal.Controls(TextBoxName(lngI)).Pr operties("Visible")
= True
Report_rptFlexLegal.Controls(TotalBoxName(lngI)).P roperties("Visible")
= True

I also size them and slide them over (note: sizes are in twips--1440
per inch)
Report_rptFlexLegal.Controls(TextBoxName(lngJ)).Pr operties("Width")
= Int(FieldWidth(lngJ))
Report_rptFlexLegal.Controls(LabelName(lngJ)).Prop erties("Width") =
Int(FieldWidth(lngJ))
Report_rptFlexLegal.Controls(TotalBoxName(lngJ)).P roperties("Width")
= Int(FieldWidth(lngJ))
Report_rptFlexLegal.Controls(TextBoxName(lngJ)).Pr operties("Left")
= LeftNumber(lngJ)
Report_rptFlexLegal.Controls(LabelName(lngJ)).Prop erties("Left") =
LeftNumber(lngJ)
Report_rptFlexLegal.Controls(TotalBoxName(lngJ)).P roperties("Left")
= LeftNumber(lngJ)

Check for older postings in this NG since other people have come up
with other ways of doing this.

James A. Fortune

Thanks James. I'll give it a try. I had a look through this NG before
I posted, but couldn't find a solution

Dave
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Richard Holliingsworth | last post by:
Hello: I have an Access 2K form I built from a SQL Server 7.0 view. I want to lock certain fields in the database from users so they can see them on the views and forms, but NOT be able to edit...
2
by: fig000 | last post by:
Hi, I have an application that's running fine on development servers (web and database-sql server 2000). I'm updating a record through a third party component but I don't think the component...
4
by: Brian Andrus | last post by:
Ok. I upgraded to MS Access 2003 recently and now I am having great heartache. In Access 2002, when I opened a table to view the data, there were wonderful little "plus" signs that I could click...
3
by: Doug | last post by:
Scenario: I select data from a SQL Server View which links 3 tables, into a single dataset table. I update some of those fields on a web form. When I want to update the db, clearly I can't update...
0
by: Brian Henry | last post by:
Here is another virtual mode example for the .NET 2.0 framework while working with the list view. Since you can not access the items collection of the list view you need to do sorting another...
2
by: Valli | last post by:
Hi, I am using a gridview to display data from table. In the gridview, there are 5 columns in which one column contains link name(eg. http://www.msn.com). I want to show this link as an...
8
by: Arno R | last post by:
Hi all. When I need to search for pictures, I always have too choose thumbnail-view manually. Is it possible to open the common dialog in thumbnail-view programmatically? Example ?? At the...
3
by: mckbill | last post by:
Is there a way I can direct the cursor to a specific field (variable) in a form by typing the field name while in form view? I have a form with many fields, and it would be nice if there were...
4
by: Jeremy | last post by:
I am writing a complex data editor, and I am building a table with other controls in it on the fly. ( I know, not for the faint of heart. My other options are a quadruply nested data repeater,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.