OK.
I had to build a database before that did something similar to what I'm trying to accomplish. I am trying to get a subform to populate based on a combo box selection...thing is, it needs to append records to a table to work. Here is the link to my db:
Contaminants and Analytes need to be associated. The both have list forms to manage data. Then frmConAna is where the association is made.
Now, on my data entry form, frmSample, I want to select a contaminate from the combo box, and then have my subform populate with as many 'blank' records as there are analytes...these records should contain the name of the analyte. Then the user should be able to fill in the rest of the fields (some of the fields are calculated). QrySampleDetails brings all the fields together for the subform, and performs the calculations.
I wasn't sure how to use Access to link the forms properly. Someone helped me on another database to link a subform to main form through code (not really link, but act like it's linked, and write code to make up for the missing linkage). Don't get me wrong...I DID try to link with Master/Child fields...however, it didn't work. I tried with the ContaminantID and SampleID. I took the code from that other db, tried to trace it and apply to this database.
I put all the code in the AfterUpdate event for the Contaminant combo box. I am getting an error that says "number of query values and destination fields are not the same"
I had to change the code a little bit to get that error message, I kept getting absolutely ridiculous error messages until I got the code looking like it is now.
Could someone take a look and possibly tell me what I've done wrong?
Thanks!!!
I had to build a database before that did something similar to what I'm trying to accomplish. I am trying to get a subform to populate based on a combo box selection...thing is, it needs to append records to a table to work. Here is the link to my db:
Contaminants and Analytes need to be associated. The both have list forms to manage data. Then frmConAna is where the association is made.
Now, on my data entry form, frmSample, I want to select a contaminate from the combo box, and then have my subform populate with as many 'blank' records as there are analytes...these records should contain the name of the analyte. Then the user should be able to fill in the rest of the fields (some of the fields are calculated). QrySampleDetails brings all the fields together for the subform, and performs the calculations.
I wasn't sure how to use Access to link the forms properly. Someone helped me on another database to link a subform to main form through code (not really link, but act like it's linked, and write code to make up for the missing linkage). Don't get me wrong...I DID try to link with Master/Child fields...however, it didn't work. I tried with the ContaminantID and SampleID. I took the code from that other db, tried to trace it and apply to this database.
I put all the code in the AfterUpdate event for the Contaminant combo box. I am getting an error that says "number of query values and destination fields are not the same"
I had to change the code a little bit to get that error message, I kept getting absolutely ridiculous error messages until I got the code looking like it is now.
Could someone take a look and possibly tell me what I've done wrong?
Thanks!!!