Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    hamilton_kane is offline Novice
    Windows 11 Access 2016
    Join Date
    Nov 2023
    Posts
    13

    Lightbulb Autopopulate field in details form


    Hi, I work for a cement contracting company and I've built a perfect program using Microsoft Access' Asset Tracking Template. I like how when you assign an asset to a contact(employee), it shows up in that contacts(employees) details form. I've also added a vehicle list and a job site list. I've made it auto populate to the asset list where it has a drop down, same as the owner dropdown for the contact list. I've tried messing around with the contact assets datasheet subform, and I can't seem to get the asset to populate into the vehicle and job site detail forms like it does with the contact details form. This is the only thing I need before it ready for launch. Any help would be appreciated as I have seemingly tried everything. Thank you!
    Original post found here: UtterAccess.com
    Click image for larger version. 

Name:	Screenshot 2023-11-14 101332.png 
Views:	22 
Size:	18.7 KB 
ID:	51025Click image for larger version. 

Name:	Screenshot 2023-11-14 101219.jpg 
Views:	21 
Size:	138.5 KB 
ID:	51024
    Last edited by hamilton_kane; 11-15-2023 at 09:07 AM.

  2. #2
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    Hi
    Can you upload your database
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  3. #3
    hamilton_kane is offline Novice
    Windows 11 Access 2016
    Join Date
    Nov 2023
    Posts
    13
    Of course. It seems to be working weird also. When you assign an item to certain employees, it auto populates to the vehicles detail form as that employee instead of the vehicle.

    <attachment removed per OP request>
    Last edited by pbaldy; 11-16-2023 at 09:51 AM.

  4. #4
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    Hi Hamilton
    You have made the mistake of using the Microsoft Template as is.
    It is meant to be used as a guide and not to be used as an actual working database.
    If you are going to use this database as a working database then it needs some modifications.

    I only looked at your Asset's table and these are my observations:-

    1. Assets should become tblAssets
    2. ID should become AssetID -
    3. Vehicle Lookup - should not have spaces in any name and this is also set as a Lookup Field. Search
    Google for "The Evils of Lookup Fields in Access database". It will list why you should not use them.
    4. Category - you have Hard Coded a list of Categories in the table field which again is a Big NO NO. Thisa list of
    Categories should be in a separate table.
    5. Type - same as Category - Types should be in a sperate table
    6. Employee - Lookup Field - Big No No
    7. Job Site - space needs deleting and the field is set as a Lookup
    8. Vehicle - field is set as a Lookup
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  5. #5
    hamilton_kane is offline Novice
    Windows 11 Access 2016
    Join Date
    Nov 2023
    Posts
    13
    Okay thank you! I will make those changes but the question still remains as my office team need to look up assets by job site and vehicle. I haven't used the vehicle lookup I will probably delete it as I made a vehicle list form for them. If you assign an asset to an employee, you can go to the employee list, click on the particular employee and on the subtab see what assets are all assigned to that particular employee. How do I get that information to pop up when I click on a certain vehicle or job site in their particular detail subtabs?

  6. #6
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    Hi
    Currently on the Assets List when you double click on an Employee there is an Event called
    "OnDblClick" which opens up the "Employee Details" Form

    You would need to apply the same Double Click Event on the Vehicle Field to open the "Vehicle details" Form
    Same applies for the "Job Site"
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  7. #7
    hamilton_kane is offline Novice
    Windows 11 Access 2016
    Join Date
    Nov 2023
    Posts
    13
    Okay great, thank you.

  8. #8
    hamilton_kane is offline Novice
    Windows 11 Access 2016
    Join Date
    Nov 2023
    Posts
    13

    Lightbulb

    Hi, that did not work as that only lets the user double click on an item and go to its details. What I need is for the user to be able to go onto the job site and vehicle lists, click on a certain vehicle or job site and see which assets are assigned to it after you assign them in the asset list. Here are some pictures to try and clarify, thank you.
    Attached Thumbnails Attached Thumbnails Screenshot 2023-11-14 122936.png   Screenshot 2023-11-14 122731.png   Screenshot 2023-11-14 122816.png  

  9. #9
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    I believe your table structure is wrong for what you want to be able to see.

    You are saying that when you select a Job Site you want to see 1 or more Employees who are currently on this site.

    Or are you saying that when you select a Job Site you want to see 1 or more Assets that are currently in use on this site.
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  10. #10
    hamilton_kane is offline Novice
    Windows 11 Access 2016
    Join Date
    Nov 2023
    Posts
    13
    I want to see 1 or more assets that are currently in use on this site

  11. #11
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    See the modified attached Job Site field in the Assets Form

    Now when you double Click the Jobsite Name the form will display the Job Site Plus all Assets
    Attached Files Attached Files
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  12. #12
    hamilton_kane is offline Novice
    Windows 11 Access 2016
    Join Date
    Nov 2023
    Posts
    13
    Perfect, it works as intended. It throws an error while opening and closing an asset though. What all did you change?
    Attached Thumbnails Attached Thumbnails Screenshot 2023-11-14 132236.png   Screenshot 2023-11-14 132330.png  

  13. #13
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    Hi

    See the attached

    I modified the code and the form now closes as it should with no error.
    Attached Files Attached Files
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  14. #14
    hamilton_kane is offline Novice
    Windows 11 Access 2016
    Join Date
    Nov 2023
    Posts
    13
    Okay thank you, you are awesome. You saved me lol, what did you change so I can change the vehicle field and so I know for future reference?

  15. #15
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    Hi

    I just changed the Open VB from a Macro to an OnClick Event as shown below:-

    Code:
    Private Sub txtOpen_Click()
    
    10        On Error GoTo txtOpen_Click_Error
             
    20        DoCmd.OpenForm "Asset Details", acNormal, "", "[ID]=" & Nz(ID, 0), , acDialog
              
    
    
              
    30        On Error GoTo 0
    40        Exit Sub
    
    
    txtOpen_Click_Error:
    
    
    50        MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure txtOpen_Click, line " & Erl & "."
    
    
    End Sub
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Autopopulate field in pop-up form
    By BrittKnee in forum Forms
    Replies: 1
    Last Post: 09-14-2020, 02:35 PM
  2. Replies: 9
    Last Post: 11-26-2017, 10:14 AM
  3. Replies: 8
    Last Post: 10-03-2014, 01:34 PM
  4. Replies: 2
    Last Post: 05-22-2014, 06:11 PM
  5. Replies: 7
    Last Post: 10-03-2012, 03:06 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