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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Fields Displayed in One Field 1

Status
Not open for further replies.

hathman23

Technical User
Joined
Dec 16, 2002
Messages
19
Location
US
Hello all, hope you can help. I currently have a table that has several category checkmarks, category 1, category 2, category 3, etc. It makes it a pain when I want to display a report of individuals with categories displayed because all the categories are always displayed. I hope you all can help I would like to open a report and instead of all the category fields showing checkmarks, create a field that says if employee1 had category1 and category6 displayed this field will just say "1, 6". what do you all think. Let me know if you need more information from me.
 
In the Detail_Format event of the report you could create a loop that creates a string by checking if the various checkboxes are true or not. Then you can display the string in a text box.

You can also do this using a function bound to the text box. Either way works.

hope this helps.

Hope this helps.

OnTheFly
 
That sounds great, could you give me a little direction on how to do that, specifically the looping thing.
 
I will give you an example. Not knowing the names of the fields or controls, you will have to extrapalate from here.

This is the code for the Event module Details_Format
Dim strCat As String
Dim intCt As Integer
Dim strField As String

strCat = ""

For intCt = 1 To 6
strField = "Category " & intCt
If Me(strField) = True Then
If strCat = "" Then
strCat = intCt
Else
strCat = strCat & ", " & intCt
End If
End If
Next intCt
Me.txtCat = strCat

This is where txtCat is the unbound text box that displays the results and that there are 6 categories to check and they are all named Category #.

Also, on a report you have to include the fields you are looking at in the module even if you are not displaying them so you will need to add the Category fields to the details section and then make them invisible. You can put them anywhere, even on top of each other or under other controls but they need to be there for this to work as written.

If you have any other questions, let me know.

Hope this helps.

OnTheFly
 
I guess I am completely retarted, I opened up the report and click build event. My fields were actually called category 1, category 2 and so on. So to me your description indicates that the only thing I had to change was the unbound text box where the results would go. I changed the unbound text box to be called txtcat so that your code would work, everytime I run it I get run time error 2727 and when I debug it sticks at the "If Me(strField) = True Then" Line. I really appreciate all your help. i will definately give you some stars.
 
Colud you give me the error description. I can't tell where the problem is from just the error number.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top