title: MS Access - Query - Replace value
body: <p>One of the fields contains ID of partner organisations. Wherever the field is populated it's one of the partner organisations. If the field is blank, it means it's the parent company. In my query, how can I populate the blank records with the ID of the parent company?</p>
  
  <p>The only thing I found was to create an expression in a new field:</p>
  
  <pre><code> SELECT Valid_Learner.LearnRefNumber, Valid_Learner.FamilyName, Valid_Learner.GivenNames, Valid_Learner.DateOfBirth, Valid_Learner.Ethnicity, Valid_LearningDelivery.FundModel, Valid_LearningDelivery.PartnerUKPRN,
  Replace([PartnerUKPRN],"","parentComanyID") AS UKPRN, 
  Valid_LearningDelivery.DelLocPostCode, Valid_LearningDelivery.LearnAimRef
  FROM Valid_Learner RIGHT JOIN Valid_LearningDelivery ON Valid_Learner.LearnRefNumber = Valid_LearningDelivery.LearnRefNumber;
  </code></pre>
  
  <p>The new field ("UKPRN") should (for the purpose of this question) have the string "parentCompanyID" whenever it's blank in the PartnerUKPRN field.</p>
  
  <p>The result is the UKPRN field displays IDs where the ID is present in the PartnerUKPRN field, but shows "#Error" where it's blank in PartnerUKPRN.</p>