Hi Folks,
I've created an update query in access and it works as expected:
I want to run this code through VBA and I would normally do this by running the above as an SQL string.
Because of the DMin statement in the access query I can't get it to work in an SQL format. I realise SQL replaces " with ', but it's not that simple.
I've seen the techonthenet example as:
To:
I can't see how to work that into my more complex SQL statement.
All ideas welcome
Many Thanks
I've created an update query in access and it works as expected:
Code:
UPDATE atblChemoPreCompoundOrder SET atblChemoPreCompoundOrder.Patient = [Forms].[frmChemoRecord].[Patient], atblChemoPreCompoundOrder.[Patient Number] = [Forms].[frmChemoRecord].[Patient Number]
WHERE (((atblChemoPreCompoundOrder.Preparation)=[Forms].[frmChemoRecord].[PreparationNotVisible]) AND ((atblChemoPreCompoundOrder.DoseRequired1)=[Forms].[frmChemoRecord].[Dose]) AND ((atblChemoPreCompoundOrder.StockReceived)=True) AND ((atblChemoPreCompoundOrder.StockUsed)=False) AND ((DMin("NextCycleDue","atblChemoPreCompoundOrder","[Preparation]='" & [Forms].[frmChemoRecord].[PreparationNotVisible] & "' And [DoseRequired1] = " & [Forms].[frmChemoRecord].[Dose] & " And StockReceived = -1 And StockUsed = 0"))=[NextCycleDue]));
Because of the DMin statement in the access query I can't get it to work in an SQL format. I realise SQL replaces " with ', but it's not that simple.
I've seen the techonthenet example as:
Code:
DMax("UnitPrice", "Order Details", "OrderID = 10248")
Code:
SELECT Max([Order Details].UnitPrice) AS MaxOfUnitPrice FROM [Order Details] WHERE ((([Order Details].OrderID)=10248));
All ideas welcome
Many Thanks