Results 1 to 9 of 9
  1. #1
    dommax is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jan 2018
    Posts
    4

    Question Beginner - Show multiple query in a form

    Hello,



    After looking up at several french forum, i did'nt found an answer to my problematic, so i come up to you.

    I am a beginner in Access using .

    I need to show 3 query on a form. I need to show this 3 query in 3 independent tables form. I would like that the users can't have an writing access on the "cells" into the table (Something like the table that Acess build for make a report). As you understood, this 3 table shall be only here for reading use.

    I would like to add another features to my table. I'd like to have hypertext link on all the records of an access field (I don't know if my translation from french access vocabulary to english is great for the "field" word, i mean column by that...) which redirect the user to a form with all the information of the record selected.

    Do you think that is feasible ? if yes, how would you do this ?

    i attached a photo that describe what i want to do. I hope that will help you to understand my needs.

    Thank you in advance.
    Click image for larger version. 

Name:	accesexample.jpg 
Views:	13 
Size:	60.5 KB 
ID:	31977

  2. #2
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Suggest you use 3 subforms, each of which shows the results for one query.
    Place the 3 subforms in your main form, one below the other

    Hyperlink is the wrong word for your second question
    You need to open your form filtered to the primary key field of the record selected
    Do this either with code in the after update event of each control or use a button for that instead
    If each item refers to the same record, only one button is needed
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  3. #3
    dommax is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jan 2018
    Posts
    4
    Thank you for your fast answering Ridders52 !

    Ok i will try with 3 subforms. Do you know if it is possible to remove the buttons which are placed at the bottom of each form (the buttons that are used to switch to another record) ?

    So, i use the "After Update" event and i use a macro to open one form that i have already build before and i filter it with the key selected into the table ? That seem great !

    but, how can i know the primary key of the item selected ?

    Thank you again..

  4. #4
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Quote Originally Posted by dommax View Post
    Thank you for your fast answering Ridders52 !

    Ok i will try with 3 subforms. Do you know if it is possible to remove the buttons which are placed at the bottom of each form (the buttons that are used to switch to another record) ?

    So, i use the "After Update" event and i use a macro to open one form that i have already build before and i filter it with the key selected into the table ? That seem great !
    but, how can i know the primary key of the item selected ?

    Thank you again..
    Open the forms in design view (main & subforms), go to the Form Property sheet & set Record Selectors = No & Navigation Buttons = No
    Suggest you use VBA event code to open the main form
    I never use macros & suggest you don't as well. VBA is just as easy & much more powerful

    Look at your table design for the primary key field
    If it's a number field called ID and you have a textbox called txtID you could use code similar to this

    Code:
    DoCmd.OpenForm "MyFormName", , ,"ID = " & Me.txtID
    For a text PK field, use text delimiters instead
    Code:
    DoCmd.OpenForm "MyFormName", , ,"ID = '" & Me.txtID & "'"
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  5. #5
    dommax is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jan 2018
    Posts
    4
    Ok so with this solution, i put a txtbox or a listbox and i use the value selected or typed in to open my form. In a first time i will do that.

    is there a solution to do that in VBA ? : get the name of a specifc "cells" of a record when i click on a random cell of this record ? (In order to do the same thing that you mentionned above without txtbox)

    I just was thinking about do this with a SQL query. something like "Select ID From mytable where [field_where_a_value_is_selected]='valueselected'". But that will not work because i can have some duplicate items in a field like "name"...

  6. #6
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Excel has cells. Access has records & fields

    The reason I said to use the PK field is, by definition, that can't have duplicates.

    You just need to have some means of referencing the PK field in your code.
    It could be a hidden textbox so users aren't even aware of its existence
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  7. #7
    dommax is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jan 2018
    Posts
    4
    Sorry, i still have some difficulties to use the Access vocabulary.
    Click image for larger version. 

Name:	access3.jpg 
Views:	12 
Size:	50.6 KB 
ID:	31978
    This is what i've done. I created a form, and inserted inside a subform filled with one of my table. i added a Txtbox with the PK as source.

    The only one remaining problem is that the txt box is linked to the main form and not to the subform. so when i select a record into the subform, the txtbox does not shows the record selected. but if i use the record selection button of the main form, it works.

    Your advices are very useful.

  8. #8
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    Go to Design view
    Set the control source of your main form to the same table as your subform.
    Then click on the edge of your subform so you are treating it as a control in your main form.
    Go to the property sheet and link Parent and Child fields using your PK field
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  9. #9
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Can also use the double click event of controls in a record to open another form.....


    And welcome to the forum......
    Attached Files Attached Files

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

Similar Threads

  1. Replies: 18
    Last Post: 03-13-2017, 12:32 PM
  2. Begginer Relationships Question
    By dluga20 in forum Access
    Replies: 8
    Last Post: 06-11-2015, 05:57 AM
  3. Show Multiple Tables in Query
    By cheechootrain in forum Access
    Replies: 9
    Last Post: 10-03-2013, 12:39 PM
  4. Relationships Question from a absolute begginer
    By Guido Meng in forum Access
    Replies: 5
    Last Post: 11-19-2012, 12:06 PM
  5. Begginer Questions
    By NoAlarms in forum Access
    Replies: 4
    Last Post: 04-11-2012, 07:58 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