Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 32
  1. #16
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    If you have already populated all tables, try this query

    Select servicename, toolname from
    T_Tool
    ,T_service
    ,T_tool_name
    Where


    T_tool.toolId = T_tool_name.toolId And
    T_service.serviceId = t_tool_name.serviceid and
    T_service.serviceId = 2

  2. #17
    davidvhp is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    15
    Hello orange again.

    I have exactly made a query just like you have posted, but instead of T_service.serviceId = 2 I have T_service.serviceId = serviceid , because I have many services, and i want that the form displayed the tools, for the different servicer. Is that possible ?

  3. #18
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Remove this part of your query
    T_service.serviceId = serviceid

  4. #19
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    try this to get all records
    Select servicename, toolname from
    T_Tool
    ,T_service
    ,T_tool_name
    Where
    T_tool.toolId = T_tool_name.toolId And
    T_service.serviceId = t_tool_name.serviceid

  5. #20
    davidvhp is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    15
    thank you again orange ,

    The thing is that I want to display in the listbox the toolID and toolname. So, being that way shouldnīt it be "Select toolID, toolname" ?

  6. #21
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Yes the Row Source of the listbox should be the query as you suggested.

  7. #22
    davidvhp is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    15
    and yet, the listbox displays always the tools from the serviceid=1 . Even if I am on the record of the serviceid=5 the listbox displays the tools from the service 1.

  8. #23
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    It sounds like you have actioned a filter, or have not done a requery.

    Look for some sample code. I'll be away most of the day.
    You'll need something like

    "Select servicename, toolname from
    T_Tool
    ,T_service
    ,T_tool_name
    Where
    T_tool.toolId = T_tool_name.toolId And
    T_service.serviceId = t_tool_name.serviceid and
    T_service.serviceId = " & Me.Listbox.value

  9. #24
    davidvhp is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    15
    the last line shouldnīt be ---> T_service.serviceId = " & Me.serviceidtextbox.value ?

  10. #25
    davidvhp is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    15
    where serviceidtextbox is the textbox with the serviceid regarded to the recorded i am seeing

  11. #26
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    How do you change the Value in the textbox, the serviceID?

    Since the value in the listbox -the toolid and toolName related to the service in the textbox - when you change the textbox value (select a different service)
    you would have to requery in order to update the data to appear in the listbox.

    If you type a value into the text box, then in the afterupdate event of the textbox,
    you could do a requery.

    The record source for the listbox is something like:
    SELECT toolId, ToolName FROM
    T_Tool, T_Tool_Name
    where
    T_Tool.ToolId = T_Tool_Name.ToolId and
    T_Tool_Name.ServiceId = Me.textbox.value

  12. #27
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    David,

    I have set up 3 tables and 2 forms hoping to help.
    The Form1 shows a combo with various selectable Services.
    Once you select a Service, the Listbox shows the related Tools
    (Id and name). When you select a new service, you must requery the Listbox,
    since it gets is data based on the combo.

    see the rowsource of the listbox and
    the afterUpdate event for the combobox

    Private Sub Combo2_AfterUpdate()
    Me.List4.Requery
    End Sub
    Hope this is useful.

  13. #28
    davidvhp is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    15
    Hello orange. Thank you for the tips.
    I donīt change the value in the text box. I simply go through the records by clicking the narrow on the bottom of the form. is there any event that is related to the changing of the record the way I discribed?

  14. #29
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    I have adjusted the database. Look at frmService.
    Bound form with a listbox.
    I think this is what you are asking about.

  15. #30
    davidvhp is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    15

Page 2 of 3 FirstFirst 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. trying to learn visual basic
    By darklite in forum Programming
    Replies: 7
    Last Post: 08-24-2011, 02:18 PM
  2. Can't see visual basic code
    By Michele Keck in forum Forms
    Replies: 5
    Last Post: 09-29-2010, 11:31 AM
  3. Query in visual basic
    By Lucas83 in forum Programming
    Replies: 1
    Last Post: 06-10-2010, 11:00 AM
  4. Record Value in Visual Basic
    By chrismec in forum Programming
    Replies: 3
    Last Post: 12-09-2009, 04:14 PM
  5. Problem when activate the Visual Basic Editor
    By milo in forum Programming
    Replies: 0
    Last Post: 05-21-2007, 09:05 AM

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