Results 1 to 2 of 2
  1. #1
    yaviens is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2014
    Posts
    8

    Post Select Rows From Different Reports

    Hi, I’m working on a DB with multiple tables. My DB consists in a lot of tables, each one for a different element and his specifications (e.g.: transmitter, sensor, relay…). The user can create loops selecting different elements (All the elements of the same loop have the same Loop ID).

    I want that when the loop is finished the user can select one of the loops he has create and see all the elements and specifications he has selected for this loop. The problem is that when I want to show in a form or report all the elements the user has selected before I can’t select each different element from his table and show in a form or report.

    Until now I have this code in a form to select an element from a report and show it, but it doesn't work very well.

    List3 is a list box in my form where is the list of elements to select.
    Boton1 is the button in my form to open the report when the element is selected
    “Transmitter Specifications” is the report with the list of elements and his specifications.

    Option Compare Database
    Option Explicit

    Private Sub boton1_Click()
    On Error GoTo Err_boton1_Click

    Dim strWhere As String
    Dim ctl As Control
    Dim varItem As Variant

    'make sure a selection has been made

    If Me.List3.ItemsSelected.Count = 0 Then
    MsgBox "Must select at least 1 element"
    Exit Sub
    End If

    'add selected values to string
    Set ctl = Me.List3
    For Each varItem In ctl.ItemsSelected
    strWhere = strWhere & ctl.ItemData(varItem) & ","

    Next varItem

    'trim trailing comma
    strWhere = Left(strWhere, Len(strWhere) - 1)

    'open the report, restricted to the selected items
    DoCmd.OpenReport "Transmitter Specifications", acPreview, , "EmpID IN(" & strWhere & ")"


    Exit_boton1_Click:
    Exit Sub

    Err_boton1_Click:
    MsgBox Err.Description
    Resume Exit_boton1_Click
    End Sub

    Private Sub List3_Click()

    End Sub




  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    What does "it doesn't work very well" mean exactly? Is EmpID really the field to filter on?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Getting multiple rows into one row in select
    By rbevers in forum Queries
    Replies: 3
    Last Post: 08-30-2013, 01:58 PM
  2. Multi select rows in recordset
    By Charlie in forum Programming
    Replies: 1
    Last Post: 01-31-2013, 11:49 PM
  3. Rows & Colums in Reports
    By smarty84handsome in forum Reports
    Replies: 3
    Last Post: 02-05-2012, 12:35 AM
  4. Percentages in reports for group rows
    By John Donovan in forum Reports
    Replies: 1
    Last Post: 12-28-2010, 09:10 AM
  5. creation of reports with fixed number of rows
    By georgia in forum Reports
    Replies: 1
    Last Post: 02-17-2010, 10:40 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums