Hello all,
I have a database with a main form (Production Form) which is based on a table that records timings for production processes.
Within this form, I have two fields: ProductionDate and ProductionWeek. I also have a separate MasterDates table (based on DCrake's example table from this very forum), which contains the following two fields: FKDMYDate and FKWeekOfFiscalYear.
What I'm looking to do is have the ProductionWeek field auto-populated with the fiscal week by reference to FKWeekOfFiscalYear in the MasterDates table; after ProductionDate has been entered - by linking ProductionDate to FKDMYDate. For info, Production Date is populated on the form by way of a button which provides the current date when clicked.
I can't figure out how to make this work or what relationships I need to have in place.
I've tried the following so far:
I've been trying to adapt the above, including the below:
Any help would be massively appreciated, including where to place relevant code (I currently have the above code placed in "Row Source" for ProductionWeek on the form) - as this could also be where I'm going wrong!
Apologies for the long post, although I thought it best to provide as much info as I could. Please let me know if having a sample of the database would help if I'm not making it clear enough.
Cheers.
I have a database with a main form (Production Form) which is based on a table that records timings for production processes.
Within this form, I have two fields: ProductionDate and ProductionWeek. I also have a separate MasterDates table (based on DCrake's example table from this very forum), which contains the following two fields: FKDMYDate and FKWeekOfFiscalYear.
What I'm looking to do is have the ProductionWeek field auto-populated with the fiscal week by reference to FKWeekOfFiscalYear in the MasterDates table; after ProductionDate has been entered - by linking ProductionDate to FKDMYDate. For info, Production Date is populated on the form by way of a button which provides the current date when clicked.
I can't figure out how to make this work or what relationships I need to have in place.
I've tried the following so far:
... which (as expected) only returns a list of the figures held in the FKWeekOfFiscalYear column (i.e. 1 repeated seven times, 2 repeated seven times... etc.).SELECT [MasterDates].[FKWeekOfFiscalYear], [MasterDates].[FKDMYDate] FROM MasterDates;
I've been trying to adapt the above, including the below:
... although I can't seem to make it work.SELECT ProductionDate, ProductionWeek
FROM [Production_Form]
INNER JOIN MasterDates
ON [MasterDates].[FKWeekOfFiscalYear]=[Production_Form].[ProductionWeek]
WHERE [MasterDates].[FKDMYDate]=[Production_Form].[ProductionDate];
Any help would be massively appreciated, including where to place relevant code (I currently have the above code placed in "Row Source" for ProductionWeek on the form) - as this could also be where I'm going wrong!
Apologies for the long post, although I thought it best to provide as much info as I could. Please let me know if having a sample of the database would help if I'm not making it clear enough.
Cheers.
Last edited: