NARAYANK991
Excel Ninja
Hi Vrunda ,
The TRIM , and match_found are both solutions which were put in after I came across the problem !
1. When I first ran the code without the TRIM and did RIGHT(tin_number,1) to extract the last character of the TIN NUMBER , so that I could check to see whether it is a "V" , I found that even though I could see that the TIN NUMBER had a "V" at the end , the program was not able to see it ! When I checked further , I saw that all the TIN NUMBERS had an extra space character at the end ; so the last character in the TIN NUMBER is a space , and not "C" , "V" , "E" , "P" ,... Hence we have to use the TRIM function to remove the extra space at the end of the TIN NUMBERS.
2. match_found is another story ! The first four dealers displayed correctly , as I kept changing the dealer name , but when I came to the fifth dealer , there was a problem because this dealer had no records. Now , when we try to enter the sixth dealer's name , there is a problem because there is no box where the dealer's name can be entered ! The form itself had changed. So , whenever we come across a dealer whose name has no records associated with it , we cannot just go to the next dealer ; instead , we have to navigate back to the original data entry form. Hence the use of match_found , which is just a VBA Boolean variable ; whenever we come across at least one entry pertaining to a dealer , we know that we can enter the next dealer's name in the same form ; when there are no entries against a particular dealer , we navigate back to the original form , and then enter the next dealer's name. match_found tells us whether any records have been found or not.
At the beginning of the section for a particular dealer , we put match_found to FALSE ; when we pass through the inner-most IF section , we put match_found to TRUE , meaning we have found at least one record for that particular dealer.
Is this explanation OK ?
Narayan
The TRIM , and match_found are both solutions which were put in after I came across the problem !
1. When I first ran the code without the TRIM and did RIGHT(tin_number,1) to extract the last character of the TIN NUMBER , so that I could check to see whether it is a "V" , I found that even though I could see that the TIN NUMBER had a "V" at the end , the program was not able to see it ! When I checked further , I saw that all the TIN NUMBERS had an extra space character at the end ; so the last character in the TIN NUMBER is a space , and not "C" , "V" , "E" , "P" ,... Hence we have to use the TRIM function to remove the extra space at the end of the TIN NUMBERS.
2. match_found is another story ! The first four dealers displayed correctly , as I kept changing the dealer name , but when I came to the fifth dealer , there was a problem because this dealer had no records. Now , when we try to enter the sixth dealer's name , there is a problem because there is no box where the dealer's name can be entered ! The form itself had changed. So , whenever we come across a dealer whose name has no records associated with it , we cannot just go to the next dealer ; instead , we have to navigate back to the original data entry form. Hence the use of match_found , which is just a VBA Boolean variable ; whenever we come across at least one entry pertaining to a dealer , we know that we can enter the next dealer's name in the same form ; when there are no entries against a particular dealer , we navigate back to the original form , and then enter the next dealer's name. match_found tells us whether any records have been found or not.
At the beginning of the section for a particular dealer , we put match_found to FALSE ; when we pass through the inner-most IF section , we put match_found to TRUE , meaning we have found at least one record for that particular dealer.
Is this explanation OK ?
Narayan