Results 1 to 5 of 5
  1. #1
    Danielt949 is offline Novice
    Windows 11 Office 365
    Join Date
    Jul 2023
    Posts
    13

    Query results to multiple textbox

    Good evening.

    Attached is a sample of what i am creating, This is not the whole project, but enough to have an understanding of what i am needing to achieve.

    Open up Form1, Select Asset Type and watch the results change in Compliance type combo box.

    If you open form design you will see that there are some hidden textbox.
    Opening the code you will see that these textbox are hidden from form startup.
    I have got code there so that when the textbox value is > 0 the textbox with then become visible.

    What i am trying to achieve is that when the asset type is selected it then sends the query results to each textbox, with only 1 result per textbox. I will be deleting the Compliance Type combo box, this was purely put in place to demonstrate the answers given by the query.



    The purpose for this is to allow a bigger form to be built around these textbox.

    cheers


    Database1.zip

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2019
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    This is not the whole project, but enough to have an understanding of what i am needing to achieve.
    Sorry, but for me it does not.
    Can you tell us in plain English about the db and what its purpose is.
    I suspect that the structure of your tables are incorrect.
    For example: In the table called "Table_NewAsset" you have ten fields with similar names: Compliance1-Compliance10. This is very common in a db that has not been "Normalized".
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    It would help if you can explain in detail what your actual process is.

    All of the Controls on the Form are Unbound and it is normal to have your Form Bound to a specific Table.

    Whoops Beaten to it
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2019
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,544
    Whoops Beaten to it
    I must have started typing MUCH earlier than yourself then
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    You are doing things the hard way all along and according to the db you posted, are not following advice given in your other threads to normalize your tables.
    Regardless, here's what I glean from your latest attachment but only for the problem posted here.
    - your form has no recordsource thus it is pointless to requery or refresh it.
    - you will have to write code to get anything into your textboxes before you can determine if AssetTypeID > 0 or not.
    - if >0 applies to compliance then the empty control is Null. Checking if >0 will return null, not a number.
    - labels that are attached to controls get the same visibility as their control, so no need to code for label visibility in your case

    Unless you have a good reason for using an unbound form you are just making a lot of work and maintenance for yourself.

    EDIT - Forgot to ask which of the 4 records would you pick from your query for the textbox values?
    I assumed you left the labels attached but they are not. Attaching them would eliminate label code lines.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Return the results of a SQL query in textbox
    By virgilio in forum Access
    Replies: 5
    Last Post: 12-16-2019, 03:55 PM
  2. Textbox needs to show query results
    By skydivetom in forum Forms
    Replies: 13
    Last Post: 10-30-2019, 10:30 AM
  3. Replies: 3
    Last Post: 10-20-2017, 03:38 PM
  4. Replies: 5
    Last Post: 05-21-2013, 02:21 PM
  5. Dsplaying query results in a textbox
    By sevanty7 in forum Access
    Replies: 2
    Last Post: 05-08-2013, 09:00 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