Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Showing only some iterations of a control/field name in a form

Status
Not open for further replies.
Jul 21, 2009
29
0
0
US
Is there a way to not show a control/field name in a form if it is identical to the "line" above it? In my example below, I only want to see each client's name appear one time even though some number of subsequent records have the same client name.

In the following simplistic example, I would like only the first iteration of Client1, client2, etc to be seen by the user.
Each iteration of Client1 is the same client. Each iteration of Data1, etc are different data, different records. That is, Client 1 in the below appears in 3 records and the form is sorted by client. If it matters, the form is built on a query

Client1 Data1 Data2 Data3
Client1 Data1 Data2 Data3
Client1 Data1 Data2 Data3
Client2 Data1 Data2 Data3
Client2 Data1 Data2 Data3
Client2 Data1 Data2 Data3
Client3 Data1 Data2 Data3

That is, I would like it to look like:
Client1 Data1 Data2 Data3
Data1 Data2 Data3
Data1 Data2 Data3
Client2 Data1 Data2 Data3
Data1 Data2 Data3
Data1 Data2 Data3
Client3 Data1 Data2 Data3

There are actually more fields involved both to be shown and not to be shown, but it does not change the concepts involved.
Finally, I would like to put a "blank line" beach time the client switches. I know how to put space between every record in a form, but not between groups of records/

I have tried using subforms (show the client name in the form, the data controls in the subform), but then cannot use continuous forms, meaning that I can then only have one client show per "page". I do not want the user to have to keep changing "pages" where only one client at a time can be seen. Using a subform in the footer seems to have the same consequence.
 
Try setting your HIDE DUPLICATES property to Yes.
I'll have to think about your other issue.

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
I believe the hide duplicates property only applies to entire records that are duplicated, and maybe only in queries where I do have that set, not to individual fields in a form. If I am wrong on that, I would need help knowing where that setting is on the form. When the control in the form is selected I do not see that property anywhere.

If this were excel, I would write an if statement that essentially said:

If Cell(-1,0) = this cell value then
this cell is "" or not visible (either would work)
move down one row
Else
insert a blank row
move down one row
End if

And loop it until the current cell is blank

In Access, I have no clue how to do something like that. And am assuming it is the best way to proceed in Access. I could probably figure out the code, but would not know where to begin to look at how to refer to the "cell" one above.
 
This can be done with conditional formatting.

The trick is to make a function that determines if it is the first record of an occurrence

Client1 Data1 Data2 Data3
Data1 Data2 Data3
Data1 Data2 Data

So the first line returns true, the next two return false. If true then set the foreground and background of the text box to the same color as the form and thus it looks like it disappears. Look at the functions in the module and the conditional formatting on the form.
 
With the help that I am receiving, I am getting closer as I play with this.

If I put the client field (control), in the main form and mark it single form view ...

Then put a subform in the footer, with the fields that change with every line item, and mark this form as continuous, ...

Then when each client appears in the top, all of the line items for that client show in the subform at the bottom.

There is one last issue here. If I have, say 15 line items (records) spread over 4 clients, I would like to see only 4 entries in the main form, one for each client, and among those 4 it would show all 15 line items in the subform in the footer. It can work if we must click next record to see the next client in the top form.

The problem is that it still shows 15 records in the top also. That is, if the first client has 3 line items, the top (main) form will cycle through that client name 3 times, with each iteration showing the exact same line items (records) in the footer subform.

Those entries in the subform are 100% identical for each time the client is called in the parent/main form. Is there a way to only show each client one time in the main form instead of the number of times for which it has line items? I see no property in the form that allows for unique entries (the way there is a setting in queries). And I already have the query set at unique entries which properly is giving the 15 entries because line item has specific fields (quantity, item ordered, etc)that are in fact different.

Am I saying this in a way that makes sense? In my little chart above, the Data fields are in fact unique 15 times. But the client field is unique only 4 times. So I only want to see 4 records in the parent/main form, with the subform in the footer showing all records that apply to the select client in the parent form.

Or, better yet, can I let all 4 clients show up at once in the main form, and whichever is selected, the subform in the footer shows all line items with that client in the record?

Anyone know how to do this?

Do I need a different query for the parent and subforms, with the query for the parent form set at unique records and calling only the client field? It is a lot more cumbersome, but sounds like it might work. Can it be done just from the one query I am using currently?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top