Page 1 of 3 123 LastLast
Results 1 to 15 of 36
  1. #1
    balderman is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2017
    Posts
    55

    Another issue I am having problems with

    I am finally almost finished with my database at work and I appreciate all the help that I have gotten so far!



    I have a form for Customer's Info and a Subform containing all their work orders. That is working great. I also created a form for Maintenance Contract Information for customer's who have a maintenance contract. I was able to create a button on my form/subform to view the Maint contract Information form but it won't let me enter a new record, it says you cannot add/change a record because you need a related record in table tblcustomers....but when I tested this I added a new customer record first before I attempted to add the main contract information so I cannot figure out the best way to do this.

  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
    Did you save the new customer record first?

  3. #3
    balderman is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2017
    Posts
    55
    yes I did...I even tried saving it and closing the form then reopening it and going back to it

  4. #4
    Join Date
    Apr 2017
    Posts
    1,776
    What about saving new customer, then closing the program and reopening? Can you after that add maintenance contract for new customer?

  5. #5
    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 code/macro do you have behind the button?

  6. #6
    balderman is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2017
    Posts
    55
    I have the open form button on the customer profile/work orders form and then on the maint contract form I have the add new record button

  7. #7
    balderman is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2017
    Posts
    55
    and no, even after saving, closing the database and reopening it still will not let me

  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
    If you highlight the button in design view and look at the Events tab of the properties sheet and then click on the "..." it should show what is in there. Copy and paste to a post please.

  9. #9
    balderman is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2017
    Posts
    55
    Click image for larger version. 

Name:	1.jpg 
Views:	9 
Size:	43.0 KB 
ID:	31745

    Click image for larger version. 

Name:	2.jpg 
Views:	9 
Size:	49.2 KB 
ID:	31746

  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
    On your Maintenance Contract Information Form/SubForm arrangement, to what have you set the SubFormControl's LinkMaster/ChildFields?

  11. #11
    balderman is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2017
    Posts
    55
    I have a customer profile and work order form that is a form/subform and then I have a separate form for the maint contract info.

    Click image for larger version. 

Name:	3.jpg 
Views:	7 
Size:	92.1 KB 
ID:	31747

  12. #12
    balderman is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2017
    Posts
    55
    I'm sorry I don't know what you mean by LinkMaster/Childfields

  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
    Just an FYI but your tblMaintContract and tblCustomers tables have duplicated field which is a no-no. All of the fields should be atomic and not be duplicated anywhere else in the RDBMS. That also points out that the tblMaintContract has fields that really belong in another table (1st and 2nd stuff). So you are saying the MaintContract Form is *NOT* a Form/SubForm arrangement?

  14. #14
    balderman is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2017
    Posts
    55
    OK so I should use the first name and last name fields from my customers table in the maint contract form? And no, it is not a form subform. I just want to be able to click on it from the customer profile/work order form/subform and have it open up separately and display the maint contract information (if there is any) or to be able to add a new record to start a maint contract for that customer

  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
    A SubForm is displayed on a Form with the use of a SubFormControl. MS Access defaults the name of the SubFormControl to the name of the "SubForm" it is displaying but it does not have to stay that way. The SubFormControl is hard to select but it is just an interface issue. You'll know you have the SubFormControl selected when the data tab of the properties shett has the thwo properties LinkMasterFields and LinkChildFields. If properly set, the subform will fill in the proper value for the LinkField when you do an add new.

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

Similar Threads

  1. Replies: 5
    Last Post: 01-08-2015, 02:08 PM
  2. CDate and CStr issue with "Invalid Use of Null" Issue
    By excellenthelp in forum Queries
    Replies: 3
    Last Post: 07-25-2014, 01:34 PM
  3. Replies: 22
    Last Post: 05-21-2013, 07:54 PM
  4. problems please help
    By stryder09 in forum Access
    Replies: 1
    Last Post: 02-15-2011, 02:24 PM
  5. Replies: 1
    Last Post: 03-31-2010, 11:57 PM

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