Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2004

    Unhappy Unanswered: Check to see if a record has already been entered.


    I'm hoping someone can help me. I have a system which creates an estimate, and the later converts the estimate to an order. My problem is that the system doesn't know to only do this one time (and users will not know whether or not an order has already been created), so I'll get duplicate orders.

    I want to write something in the code to the effect of...

    Go look at the orders table and see if there is one with this Estimate ID...if there is, send a message, if not, convert the estimate...

    I can handle the IF/THEN part, but...I can't figure out the code for the first half (see if there is one already there).

    Thanks for your help!


  2. #2
    Join Date
    Nov 2004

    Try this

    If IsNull(Dlookup("EstimateID", "TableFieldIsFoundIn", "EstimateID = " & strEstimateID))
    msgbox "EstimateID does not exists"
    msgbox "EstimateID exists"
    end if

    Its slow but it works

  3. #3
    Join Date
    Mar 2004
    Berlin, Germany
    what about building a 1:1 relationship between both tables (Estimate table as master) and use referential integrity to ensure that there is definitely only 0 or 1 order per estimate.

    build a "wrapperquery" for your estimate table (all fields from estimate and at least the orderID from the order table .. use a right join) then base your form on the query instead of the table. you can now check the orderID field directly to display the order button or not.

  4. #4
    Join Date
    Apr 2004
    Thanks everyone - you've given me two great ways to think about this...I truly appreciate your help!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts