Dynamically setting recordsource for a form

teambond

Registered User.
Local time
Today, 00:57
Joined
Jun 2, 2013
Messages
24
Hi,

Can I please get some help with whether my logic is correct on a change I'm making before I start troubleshooting why it's not working.

I currently have a Job Management System where the Customer Order Form displays all jobs via a main form and an order details subform. This form is used for inputting new jobs and for viewing existing jobs via links from other reports such as a job schedule or customer orders report. It is always reached via a clicking of a "New Customer Order" Button where the form is filtered to new record or via double clicking on an order number in another screen and filtered via the order number.

I am now in a position where the database is growing too large and I want to archive the data in the Orders / OrderDetails Tables into Financial Years and put them in a separate backend database. However the jobs will still need to be viewed via the customer order form in order for them to be duplicated the following year.

I have created a union query of the PreviousFY and Current Orders to allow the "search jobs by customer" query to work. This works fine, but I now need to make the record source of the Customer Order form dynamic.

I have created a CurrentFY query to feed the form if it is a current job and a PrevFY query if it's from the previous FY.

I have written code to check the OrderDate against the financial year to work out which database the job is from and set recordsource according to that result. This is currently in the OnCurrent event as I also have other code there that checks details of the order to determine if fields should be editable.

However I am finding that when I parse the order data between the forms the "new record" command or the order number is not being retained or checked. If this because I don't have a recordsource set when it opens?

I tried setting the recordsource as the currentFY on open and then do the check but that didn't work.

Just want to see if there's something fundamentally wrong with what I'm trying to do before I spend a heap of time fault finding.

Thanks
 
Don't archive. I've tried it and it is a pain in the posterier. It is better to qulaify the data into either Current or History or by Year.

I not trying to be negative but the logic was undeniable but the implementation impractical. I still get Current and Historical Data.

Simon
 

Users who are viewing this thread

Back
Top Bottom