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

Double click Field to add to another Table

Status
Not open for further replies.

Steven547

Technical User
Sep 15, 2004
165
US
I have a form. One table lists all the companies. A report is run based off those companies. However, I would like to give the user the ability to select which companies they want to run the report for.
So, they could double click a company and it would appear in maybe a "temp" box that the query would be based off of. Or maybe click an arrow that would add that company name to a box that they could run the report...make sense?
How would I do this?

Thanks.
 
How about a multi-select listbox? You'll find the Multi Select option of the listbox's property sheet. You then have to code to read the selections. So it would read a company and produce the report, then go to the next one. If you search the Access forums, you'll find code to do so. Or in a book.
 
Is there an actual name for this maybe? I have a bunch of access books, but couldn't find where this would be. But it would be a listbox then, right?
I just have to figure out how to do that...transfer from one list box to another...
 
I looked in the indexes of my access books and found Listbox. Then the subtopic multiselect or multiselection.
I typed in Listbox in Access help and found the topic Multiselect property.
I googled.
Found faq702-6326 by looking through the Access forums.

Here's some code to select items in a listbox, print individual reports and show on a label control the reports just printed.
Private Sub Command6_Click()
Dim stDocName As String
stDocName = "Property_Manager_With_Data4"
Dim frm As Form, ctl As Control
Dim varItm As Variant
Dim strList As String
Dim strList2 As String
strList = ""
Set frm = Forms![MultiSelect_PropertyManager_Form]
Set ctl = frm![mmclist]
For Each varItm In ctl.ItemsSelected
strList = "'" & ctl.ItemData(varItm) & "'"
strList2 = strList2 & "'" & ctl.ItemData(varItm) & "'" & ", "
DoCmd.OpenReport stDocName, acNormal, , "[MMCNumber] IN (" & strList & ")"
Me![NowPrinting].Caption = strList2
Next varItm
End Sub
 
Thank you very much. I'll have to look into this. It would be a really nice feature if I can get this to work!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top