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

Hiding a Label and Textbox in DataReport

smartchap
100+
P: 236
I have a table having 3 fields viz. SNo, FName and LName. The table has 10 records having SNo from 1 to 10. In DataReport I have 3 labels and 3 textboxes. I want to display all records from 1 to 10 but not to show record No having SNo = 5, i.e. want to hide all label and textboxes in DataReport when SNo = 5. How to hide these on DataReport for a particular record? Please help me.

Always Believe in GOD!
Jan 30 '08 #1
Share this Question
Share on Google+
9 Replies


debasisdas
Expert 5K+
P: 8,127
That can be done by SQL query.
Jan 30 '08 #2

smartchap
100+
P: 236
Sorry I did not make requirement clear. I had already used WHERE SNo <>5 in my SQL statement. Actually I want to hide some labels and textboxes for record with SNo = 5 (not all).
Thanks.
Jan 30 '08 #3

debasisdas
Expert 5K+
P: 8,127
Sorry I did not make requirement clear. I had already used WHERE SNo <>5 in my SQL statement. Actually I want to hide some labels and textboxes for record with SNo = 5 (not all).
Thanks.
Are you using separate label for each record ?
Jan 30 '08 #4

Expert 5K+
P: 8,434
Are you using separate label for each record ?
Isn't there an event which fires after the record is read (AfterRead or something) where you could turn the visibility on or off? (I haven't used a DataReport).
Jan 30 '08 #5

smartchap
100+
P: 236
Actually I am having 2 tables and appended them in one separate table. Both tables have different different fields and in new table I have created a new field 'SNo'. Suppose table1 has 10 records, they will be saved in new table from record No 1 to 10 having SNo= 1 to 10 respectively and if table2 has 5 records (with different fields than table1) then these records will be appended in new table from Record No 11 to 15 having SNo=11 to 15 respectively. New table has all the fields in table1 and table2 plus one additional field SNo. Now I want in DataReport that for SNo<=15 fields labels and textboxes associated with these fields to be displayed and labels and textboxes associated with table2 not to be displayed. Similarly for SNo>=11 AND <=15 labels and textboxes associated with table1 not to be displayed but associated with table2 only to be displayed. Please help me.
Thanks.
Feb 1 '08 #6

smartchap
100+
P: 236
There must be a messiah to help me.
Feb 5 '08 #7

debasisdas
Expert 5K+
P: 8,127
There must be a messiah to help me.
If there is no record ,is the report still showing you some data ?
Feb 5 '08 #8

QVeen72
Expert 100+
P: 1,445
Hi,

In Such Cases, You have to Create a SQL Query like :
Say In NewTable, (SNO 1 to 10) , You are saving in Field1, Field2, Field3
and For Table2 You are Saving in Field4 , Field5 , Field6 (SNo 11 To 15)
and you need to display Field1 or Field4 (depending on SNo) ...

For that you have 2 approaches.. Change SQL Query Accordingly..
Some thing like this :

Select A.SNo, A.Field1 As FldX, A.Field2 As FldY, A.Field3 As FldZ From NewTable A Where SNO <=10
UNION ALL
Select B.SNo , B.Field4 As FldX, B.Field5 As FldY, B.Field6 As FldZ From NewTable B Where SNO > 10

Note : In above Query, you need to have Same Field Type for Field1 and Field4..

2 Method:

Select SNo, Trim(Field1 & Field4) As FldX, Trim(Field2 & Field5) As FldY,
Trim(Field3 & Field6) As FldZ From NewTable Order By SNo

In Above Query, If both the fields are different, you can use Explicit Conversions..
Say Field1 Is Text and Field4 is Numeric, then you can give this in access:

Select SNo, Trim(Field1 & Cstr(Field4)) As FldX, Trim(Field2 & Field5) As FldY,
Trim(Field3 & Field6) As FldZ From NewTable Order By SNo

Now Design the DataReport on FldX, FldY, FldZ.

These Kind of Reports are done a Lot More Easier in Crystal Reports (All Versions). Just Place Fields One above the other, and Suppress Blank Values For Numeric Fields..


Regards
Veena
Feb 5 '08 #9

smartchap
100+
P: 236
Sorry Veena for the delay in reply. Actually I am poor in SQL and specially in DataReport with SQL. I don't know how to play with records to be shown in DataReports. I don't have Crystal Reports and want output in DataReports. Please help me with an attachment which will guide me how to design Data Report on FldX, FldY, etc. It will be a great help for me. I hope u will take a little pain for me to attach an example as it is very much clear u understood my problem and have solution.
Thanks in advance.
Apr 26 '08 #10

Post your reply

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