Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New Record Created when no Match Found ....

Status
Not open for further replies.

roxannep

Technical User
Jun 20, 2000
69
Situation: transactional data in table has Email in common with Contacts data. However, transactional data generally comes in before remainder of contact data (name, address). Some transactional data is from repeat customers. <br><br>Have a loop set up to check each record in the daily temporary transactional table to see if a corresponding record exists in Contacts via the email address. MUST have a contacts record to have a transaction record. If no contacts record with matching email, I need to have Access create a new record and paste the email address into the contacts table before I paste append the transaction information. <br><br>Stuck on the command code between the DoUntil EOF and EndLoop to have it perform command to&nbsp;&nbsp;create a new record in a different table and paste the email address only from transaction table that the Do Until is running on into the new contact record under the IF NOT (no match) condition ......<br>
 
I'm not sure I understand the whole of your problem, but here is some sample code (Note - test it, if you decide to try it;-)<br><br>DO While not rstTempTrans.EOF<br>&nbsp;&nbsp;If &quot;your nomatch condition&quot; Then<br>&nbsp;&nbsp;&nbsp;&nbsp;rstCont.AddNew<br>&nbsp;&nbsp;&nbsp;&nbsp;rstCont!Email=rstTempTrans!Email<br>&nbsp;&nbsp;&nbsp;&nbsp;rstCont!otherflds=rstTempTrans!otherflds<br>&nbsp;&nbsp;&nbsp;&nbsp;...<br>&nbsp;&nbsp;&nbsp;&nbsp;rstCont.Update<br>&nbsp;&nbsp;End If<br>Loop<br><br>Also, DougP has an excellent article in the FAQ section marked of this forum &quot;How do I add data to more than one Table&quot;.<br>
 
Roy -&nbsp;&nbsp;I think that's on the right track, but I'm still having problems getting it to recognize the no match.<br><br>I have reposted the question on July 10 under Do Loop .... Still Confused with a better step-be-step of what I'm looking for. If you have any further help on the code for actually asking it to determine if there is no match and then proceeding with the copy and paste append, I would appreciate it. I have tried several things and perhaps have just tried too many now and am rummy with failures.<br><br>Thanks for any help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top