Page 1 of 3 123 LastLast
Results 1 to 15 of 32
  1. #1
    accessnewtome is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2016
    Posts
    13

    Add a New Customer Button to a Subform not working...

    Hey all, new to access so please excuse my lack of knowledge.

    I'm sure this is pretty simple to do but I have a 11 week old baby so I don't have as much time as I used to . Let's see if I can be not so confusing here...

    OK, so I have a "home" page form. On there, I have a sub form "ContractorsSubform" that lists the contractors that I work for. I have it so that if I click on the contractor ID number in the sub form, it opens up a form that shows all the contractor information; i.e. company name, rate, etc.. called simply "Contractors".

    On this same "Contractors" form, I have a sub form called "ContractorsCustomersSubForm" that lists all the customers that go with that specific contractor; it has limited info just to identify the customer and like the home page; I can click on the CustomerID and go directly to the customers information form "ContractorsCustomers". Al this works.

    My problem(s)...

    I have a button on the "Contractors" form called "New Customer". So when I click on a ContractorID, it takes me to the specific contractor. There I have the button "New Customer", I want the form "ContractorsCustomers" to open so that I can add a new customer to that Contractor. When I click my button, it does open up the blank form; however I don't know how to tie it to the currently selected contractor. The result is when I add a customer, it goes into the table "ContractorsCustomersTable", but it is not assigned to the contractor. If I enter a new record directly into the sub form "ContractorsCustomersSubForm", the record saves. I then can click on the CustomerID and go the full form and add the rest of the data. Sure I could just do it this way, but would be nice to just have a button.



    Also, which is part of my disconnect, when this blank form "ContractorsCustomers" opens I need the Contractor Name to show in the company name field and it does not.

    I have attached some screen shots. Excuse the layout as I am just trying to get it functioning first.
    Any thoughts, suggestions, better ways would be much appreciated.
    Thank you!
    Attached Thumbnails Attached Thumbnails Home_Form.jpg   Contractors Form.jpg   Contractors Customers Form.jpg  

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    See if this link helps at all: http://www.baldyweb.com/OpenArgs.htm

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    I'd like to know about your tables and relationships, and a brief description of what you want to accomplish.
    Good luck with your project.

  4. #4
    accessnewtome is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2016
    Posts
    13
    Thank you for your response. Here's the deal. I am a self employed audio/video/integration professional. I have my own customers as well as sub my tech services to other contractors. I am trying to build a database that will replace using excel and a notebook.

    To start, I am trying to build a database of my customers and my contractors with their customers as everything I do starts with this information. As I said, my customers database is working fine; adding a contractor is working fine; it's trying to add a new customer under a specific contractor via a button that I can't get working.

    Each customer has embedded subforms that I can record specific information about the customers project/job site. This way I can have quick documented access to any customers project information that I need instead of paging through my notebook.

    After I get this working, I will incorporate inventory, pricing, and invoicing. Currently I do all my invoicing and quotes in excel.
    Then I have a Microsoft surface tablet that I will be carrying around utilizing the OneDrive storage for my access database.

    I have attached a screenshot of my relationships tables. Thank you for your help!
    I still have yet to get to RuralGuy's suggestion.
    Attached Thumbnails Attached Thumbnails Relationships.jpg  

  5. #5
    accessnewtome is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2016
    Posts
    13
    Really stuck on this and I'm sure it's easy if you're a VBA master but I am not...sadly.

    Where I'm at:

    When I click on "New Customer" button I can open up the form "ContractorsCustomers".
    I have the text box "Contractors Name" fill in automatically the current contractor I am adding the customer to.
    I have added the ContractorID text box to the "ContractorsCustomers" form and also have that automatically fill in the current contractors Primary Key ID number.


    What I need it to do:

    When I click the "Save and Exit" button on the "ContractorsCustomers" form, I need to add that data to the table where the info is stored for the contractors called "tblContractorsCustomers".
    I can save the data to the table, however when I go to the table, it just adds it to the table and does not associate the Primary Key ID for that contractor.

    Seems really simple but I can't get it to work with all the stuff I've tried that I found online.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What is the Record Source of the "ContractorsCustomers" form? I guess I would also have to ask why it is not the "tblContractorsCustomers" table or better yet a query of the same.

  7. #7
    accessnewtome is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2016
    Posts
    13
    The record source for "ContractorsCustomers" form is "tblContractorsCustomers". That's why I don't understand why it's not working.

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    It sounds like you need to do a Requery after the "ContractorsCustomers form closes.

  9. #9
    accessnewtome is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2016
    Posts
    13
    I give it a try. Thank you.

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    It is easy if you open the "ContractorsCustomers" form in dialog mode.

  11. #11
    accessnewtome is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2016
    Posts
    13
    Nope...I'm just a moron! No worky. I'm attaching my project in case you want to look at it. Might make more sense (or less).
    Attached Files Attached Files

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Are you interested in learning how to fix it along with learning a bit more about Access?

  13. #13
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I asked the question because it might take some time to adjust what you have already done in the database. It would be a commitment of time for both you and me.

  14. #14
    accessnewtome is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Sep 2016
    Posts
    13
    Absolutely I am interested. I don't want someone to just do it for me, I want to learn. I just don't have the same time I used to have before my daughter was born 4 months ago. So it is taking me more time to do anything. I am very appreciative for any help!

  15. #15
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I'll be glad to help. Give me a bit of time to do a couple of chores.

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

Similar Threads

  1. Replies: 13
    Last Post: 01-22-2015, 05:27 PM
  2. Replies: 6
    Last Post: 12-11-2013, 09:27 PM
  3. Replies: 4
    Last Post: 10-08-2012, 05:33 PM
  4. Replies: 2
    Last Post: 09-11-2012, 07:54 AM
  5. Replies: 1
    Last Post: 12-24-2011, 08:48 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