JSimoncelli
Registered User.
- Local time
- Today, 00:45
- Joined
- Apr 23, 2012
- Messages
- 73
Hello All,
I have an issue I am trying to resolve, I have a possible method to resolve this issue but I need help with the possible code. Also, if there is a better way to go about solving the issue please let me know.
Background: I am using Access 2007; if you look at the attached Relationship image you can see the database setup. This is a material control/tracking database; the material in question can be CD/DVD’s, documents, hard drives or other types of material.
The tblMaterial table consists of information unique to each piece of material. The tables on the left side are predefined information that is represented in the tblMaterial table as FK’s. The tblSentDetails and tbleReceivedDetails tables represent information of when material is sent or received. Each records in either the sent or received tables can have one or more pieces of materials, for example I can send a CD and five documents in one shipment as well as receive several pieces of material in another. The tblCarrier table consist a list of possible methods of shipment e.g. UPS FedEX ect, and the SentHow and ReceivedHow fields draw from this table. By the same token the Originator, SentTo and ReceivedFrom draw from the tblOrganization table.
Issue: When material records are added or edited I need a way to associate either the received and/or sent details with individual material records.
After a couple of days trying several different possibilities the following is what I came up with, I believe it is simple and efficient.
I created an add/edit form (frmEditAdd bound to tblMaterial table), the form it’s self functions very well and I have no problems with it as a whole. Since the sent details and received details functionally are the same I will concentrate on the received details and duplicate the process for the sent details.
On the EditAdd form (see attached image) the Received From, Received How, and Received Receipt Mailed draw their information from the ReceivedDetails table and are displayed using a sub-form. The process I came up with to solve my issue is an unbound combo box. The row source of the combo box is the attached query qryDetailSelect2 (see attached image). This query draws from the ReceivedDetails table. In the qryDetailSelect2 query the first column is a combination of the ReceivedDate and MailRegNum and is used as a visual reference for the user, the second column is the ReceivedDetailID and the third is again the ReceivedDate field. The reason for the second received date reference is allow me to sort the query with the “newest” record on top, less searching for the user. The combo box is setup to show the first column hiding the other two, column with 1”;0”;0” and column count 3. You can see the result of this part of the process in the frmEditAdd image far right see arrow.
Now here’s what I need help with, the information in the tblReceivedDetails table and subsequent qryDetailSelect2 query is input through another from/process and the user will/should be familiar with the received date and mail registration number. Below is what I want the combo box to do:
With the record selected in the form, the user would use the combo box to display a list of the available Received Details records. Because the query is sorted by newest received date the desired record should be at or near the top. Once selected, I want the ReceivedDetailID of the selected record (see qryDetailSelect2) to be written to the ReceivedDetails (FK) in the tblMaterial table. This will populate the fields in the EditAdd form associated with the ReceivedRetails table. Once saved this should work.
I am looking for the code to do this.
This is the process I came up with to solve my issue, if you feel there is a better way to accomplish this please let me know.
Thanks in advance
John
I have an issue I am trying to resolve, I have a possible method to resolve this issue but I need help with the possible code. Also, if there is a better way to go about solving the issue please let me know.
Background: I am using Access 2007; if you look at the attached Relationship image you can see the database setup. This is a material control/tracking database; the material in question can be CD/DVD’s, documents, hard drives or other types of material.
The tblMaterial table consists of information unique to each piece of material. The tables on the left side are predefined information that is represented in the tblMaterial table as FK’s. The tblSentDetails and tbleReceivedDetails tables represent information of when material is sent or received. Each records in either the sent or received tables can have one or more pieces of materials, for example I can send a CD and five documents in one shipment as well as receive several pieces of material in another. The tblCarrier table consist a list of possible methods of shipment e.g. UPS FedEX ect, and the SentHow and ReceivedHow fields draw from this table. By the same token the Originator, SentTo and ReceivedFrom draw from the tblOrganization table.
Issue: When material records are added or edited I need a way to associate either the received and/or sent details with individual material records.
After a couple of days trying several different possibilities the following is what I came up with, I believe it is simple and efficient.
I created an add/edit form (frmEditAdd bound to tblMaterial table), the form it’s self functions very well and I have no problems with it as a whole. Since the sent details and received details functionally are the same I will concentrate on the received details and duplicate the process for the sent details.
On the EditAdd form (see attached image) the Received From, Received How, and Received Receipt Mailed draw their information from the ReceivedDetails table and are displayed using a sub-form. The process I came up with to solve my issue is an unbound combo box. The row source of the combo box is the attached query qryDetailSelect2 (see attached image). This query draws from the ReceivedDetails table. In the qryDetailSelect2 query the first column is a combination of the ReceivedDate and MailRegNum and is used as a visual reference for the user, the second column is the ReceivedDetailID and the third is again the ReceivedDate field. The reason for the second received date reference is allow me to sort the query with the “newest” record on top, less searching for the user. The combo box is setup to show the first column hiding the other two, column with 1”;0”;0” and column count 3. You can see the result of this part of the process in the frmEditAdd image far right see arrow.
Now here’s what I need help with, the information in the tblReceivedDetails table and subsequent qryDetailSelect2 query is input through another from/process and the user will/should be familiar with the received date and mail registration number. Below is what I want the combo box to do:
With the record selected in the form, the user would use the combo box to display a list of the available Received Details records. Because the query is sorted by newest received date the desired record should be at or near the top. Once selected, I want the ReceivedDetailID of the selected record (see qryDetailSelect2) to be written to the ReceivedDetails (FK) in the tblMaterial table. This will populate the fields in the EditAdd form associated with the ReceivedRetails table. Once saved this should work.
I am looking for the code to do this.
This is the process I came up with to solve my issue, if you feel there is a better way to accomplish this please let me know.
Thanks in advance
John
Last edited: