Save value from subform to table

D

drewship

Hello all.

The title of this question seems easy enough but I have been beating my head
against a brick wall for 2 days. What I have is a subform based on the below
query which works correctly up to a point.

SELECT [Order Details].*, Products.*, CCur(Nz([Quantity],0)*[Unit Cost]) AS
[Extended Price]
FROM Products INNER JOIN [Order Details] ON Products.ProductID = [Order
Details].ProductID;

There is a field on the 'Order Details Subform' called 'ServiceType' that
has a control source of 'Products.Service Type' and is set using a 'Set'
macro with an Item of [ServiceType] and an expression of 'DLookUp("[Service
Type]","Products","ProductID = " & [ProductID])'. This correctly populates
the subform with the 'Service Type' from the 'Products' table.

The problem I am having is I need the value of 'ServiceType' to be saved to
an 'Orders Details' table in the 'Service Type' field. Since the Control
Source is already being used by 'Products.Service Type'. I tried using the
below 'Set' macro (just one example of many things I tried...this seems the
most logical to me) to take the value of 'ServiceType' from the 'Order
Details Subform' and save it to the 'Orders Details' table', but this does
not work.

This is located in the 'After Update' section of the 'Order Details Subform'
'ServiceType' field. I believe that after the 'ServiceType' field is updated,
the macro should run and save the current value of 'ServiceType' to the
desired table, but it does not.

Item is set to '[Order Details]![Service Type]'
Expression is set to '[Forms]![Add an Order and Details]![Order Details
Subform].[Form]![ServiceType]'

Can someone please help me out? Thanks in advance!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top