Here's my update query. It doesn't update at all. I have a button to open
it from the form named Loads
UPDATE DISTINCTROW Loads INNER JOIN Rates ON Loads.ID = Rates.ID SET
Rates.CitytoCityRate = DLookUp("[FlatRate] ","CustomerPtoP","[OriginCity]="
& [Forms]![Loads]![Rates]![OriginCity] & " And [DestinationCity]= " &
[Forms]![Loads]![Rates]![DestinationCity] & "And [CustomerID]= " &
[Forms]![Loads]![CustomerID]), Rates.Miles =
[Forms]![Loads]![MilestoConsignee], Rates.LinehaulRPM =
DLookUp("[RatePerMile]","CustomerZiptoZip","[CustomerID]=" &
[Forms]![Loads]![CustomerID] & "and [MinOriginZip] <=" &
[Forms]![Loads]![Combo43] & "and [MaxOriginZip] >=" &
[Forms]![Loads]![Combo43] & "and [MinDestinationZip] <=" &
[Forms]![Loads]![Combo45] & "and [MaxDestinationZip] >=" &
[Forms]![Loads]![Combo45]), Rates.ZIPtoZIPRate = [Miles]*[LinehaulRPM]
WHERE (((Loads.ID)=[Forms]![Loads]![ID]));
I am trying to save the value because we will change the rates from time to
time and I need to freeze them at the time of entry.
Thanks for replying,
Mike
Any Text fields must have their criteria delimited by either ' or "
delimiters. Which fields are numeric and which are text?
Also, you have missing blanks. For instance, if OriginCity is San
Francisco and DestinationCity is Boise, your DLookUp would contain the
string
[OriginCity] =San Leandroand [DestinationCity]= Boiseand
I would recommend a completely different approach, NOT using a DLookUp
at all! Use a Join query instead; could you explain the meaning of the
ID field? Why does Rates have an ID?
John W. Vinson[MVP]